diff options
| author | David S. Miller <davem@nuts.davemloft.net> | 2004-07-05 06:39:01 -0700 |
|---|---|---|
| committer | David S. Miller <davem@nuts.davemloft.net> | 2004-07-05 06:39:01 -0700 |
| commit | 00e11c5f00dbfe2a65f796da881f9bb5b4ce5cbf (patch) | |
| tree | dd43b2a475cee98fab9babda6e1c460bf15c5acd /include | |
| parent | 18c9628e51ae509054a69a0feb5b834be0f9324d (diff) | |
[PKT_SCHED]: Do not embed spinlock in tc_stats structure.
This makes it not get sized/copied around to/from
userspace correctly. The real crux of the problem
comes from the rtnetlink attribute copying line which
read:
RTA_PUT(skb, TCA_STATS, (char*)&st->lock - (char*)st, st);
which is not necessarily sizeof(struct tc_stats) due
to alignment issues.
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/pkt_sched.h | 3 | ||||
| -rw-r--r-- | include/net/pkt_act.h | 2 | ||||
| -rw-r--r-- | include/net/pkt_sched.h | 7 |
3 files changed, 6 insertions, 6 deletions
diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h index ef350df8e560..c96c174d32d9 100644 --- a/include/linux/pkt_sched.h +++ b/include/linux/pkt_sched.h @@ -38,9 +38,6 @@ struct tc_stats __u32 pps; /* Current flow packet rate */ __u32 qlen; __u32 backlog; -#ifdef __KERNEL__ - spinlock_t *lock; -#endif }; struct tc_estimator diff --git a/include/net/pkt_act.h b/include/net/pkt_act.h index 9f37ac40f1a0..6baa9614f56c 100644 --- a/include/net/pkt_act.h +++ b/include/net/pkt_act.h @@ -258,7 +258,7 @@ tcf_hash_create(struct tc_st *parm, struct rtattr *est, struct tc_action *a, int p->tm.lastuse = jiffies; #ifdef CONFIG_NET_ESTIMATOR if (est) { - qdisc_new_estimator(&p->stats, est); + qdisc_new_estimator(&p->stats, p->stats_lock, est); } #endif h = tcf_hash(p->index); diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h index 99bc7af242a5..825e11014edb 100644 --- a/include/net/pkt_sched.h +++ b/include/net/pkt_sched.h @@ -96,6 +96,7 @@ struct Qdisc struct net_device *dev; struct tc_stats stats; + spinlock_t *stats_lock; struct rcu_head q_rcu; int (*reshape_fail)(struct sk_buff *skb, struct Qdisc *q); @@ -376,6 +377,7 @@ struct tcf_police struct qdisc_rate_table *P_tab; struct tc_stats stats; + spinlock_t *stats_lock; }; #ifdef CONFIG_NET_CLS_ACT @@ -391,6 +393,7 @@ struct tcf_##name *next; \ int action; \ struct tcf_t tm; \ struct tc_stats stats; \ + spinlock_t *stats_lock; \ spinlock_t lock @@ -436,7 +439,7 @@ extern int tcf_act_police(struct sk_buff **skb, struct tc_action *a); #endif extern int tcf_police(struct sk_buff *skb, struct tcf_police *p); -extern int qdisc_copy_stats(struct sk_buff *skb, struct tc_stats *st); +extern int qdisc_copy_stats(struct sk_buff *skb, struct tc_stats *st, spinlock_t *lock); extern void tcf_police_destroy(struct tcf_police *p); extern struct tcf_police * tcf_police_locate(struct rtattr *rta, struct rtattr *est); extern int tcf_police_dump(struct sk_buff *skb, struct tcf_police *p); @@ -479,7 +482,7 @@ void dev_deactivate(struct net_device *dev); void qdisc_reset(struct Qdisc *qdisc); void qdisc_destroy(struct Qdisc *qdisc); struct Qdisc * qdisc_create_dflt(struct net_device *dev, struct Qdisc_ops *ops); -int qdisc_new_estimator(struct tc_stats *stats, struct rtattr *opt); +int qdisc_new_estimator(struct tc_stats *stats, spinlock_t *stats_lock, struct rtattr *opt); void qdisc_kill_estimator(struct tc_stats *stats); struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r, struct rtattr *tab); void qdisc_put_rtab(struct qdisc_rate_table *tab); |
