diff options
-rw-r--r-- | include/net/sch_generic.h | 9 | ||||
-rw-r--r-- | net/sched/sch_choke.c | 3 | ||||
-rw-r--r-- | net/sched/sch_netem.c | 3 | ||||
-rw-r--r-- | net/sched/sch_sfb.c | 3 | ||||
-rw-r--r-- | net/sched/sch_sfq.c | 5 |
5 files changed, 13 insertions, 10 deletions
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index f6bb08b73ca4..55ce96b53b09 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h | |||
@@ -220,9 +220,16 @@ struct tcf_proto { | |||
220 | 220 | ||
221 | struct qdisc_skb_cb { | 221 | struct qdisc_skb_cb { |
222 | unsigned int pkt_len; | 222 | unsigned int pkt_len; |
223 | long data[]; | 223 | unsigned char data[24]; |
224 | }; | 224 | }; |
225 | 225 | ||
226 | static inline void qdisc_cb_private_validate(const struct sk_buff *skb, int sz) | ||
227 | { | ||
228 | struct qdisc_skb_cb *qcb; | ||
229 | BUILD_BUG_ON(sizeof(skb->cb) < sizeof(unsigned int) + sz); | ||
230 | BUILD_BUG_ON(sizeof(qcb->data) < sz); | ||
231 | } | ||
232 | |||
226 | static inline int qdisc_qlen(const struct Qdisc *q) | 233 | static inline int qdisc_qlen(const struct Qdisc *q) |
227 | { | 234 | { |
228 | return q->q.qlen; | 235 | return q->q.qlen; |
diff --git a/net/sched/sch_choke.c b/net/sched/sch_choke.c index e465064d39a3..7e267d7b9c75 100644 --- a/net/sched/sch_choke.c +++ b/net/sched/sch_choke.c | |||
@@ -148,8 +148,7 @@ struct choke_skb_cb { | |||
148 | 148 | ||
149 | static inline struct choke_skb_cb *choke_skb_cb(const struct sk_buff *skb) | 149 | static inline struct choke_skb_cb *choke_skb_cb(const struct sk_buff *skb) |
150 | { | 150 | { |
151 | BUILD_BUG_ON(sizeof(skb->cb) < | 151 | qdisc_cb_private_validate(skb, sizeof(struct choke_skb_cb)); |
152 | sizeof(struct qdisc_skb_cb) + sizeof(struct choke_skb_cb)); | ||
153 | return (struct choke_skb_cb *)qdisc_skb_cb(skb)->data; | 152 | return (struct choke_skb_cb *)qdisc_skb_cb(skb)->data; |
154 | } | 153 | } |
155 | 154 | ||
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c index 2776012132ea..e83d61ca78ca 100644 --- a/net/sched/sch_netem.c +++ b/net/sched/sch_netem.c | |||
@@ -130,8 +130,7 @@ struct netem_skb_cb { | |||
130 | 130 | ||
131 | static inline struct netem_skb_cb *netem_skb_cb(struct sk_buff *skb) | 131 | static inline struct netem_skb_cb *netem_skb_cb(struct sk_buff *skb) |
132 | { | 132 | { |
133 | BUILD_BUG_ON(sizeof(skb->cb) < | 133 | qdisc_cb_private_validate(skb, sizeof(struct netem_skb_cb)); |
134 | sizeof(struct qdisc_skb_cb) + sizeof(struct netem_skb_cb)); | ||
135 | return (struct netem_skb_cb *)qdisc_skb_cb(skb)->data; | 134 | return (struct netem_skb_cb *)qdisc_skb_cb(skb)->data; |
136 | } | 135 | } |
137 | 136 | ||
diff --git a/net/sched/sch_sfb.c b/net/sched/sch_sfb.c index 96e42cae4c7a..d7eea99333e9 100644 --- a/net/sched/sch_sfb.c +++ b/net/sched/sch_sfb.c | |||
@@ -94,8 +94,7 @@ struct sfb_skb_cb { | |||
94 | 94 | ||
95 | static inline struct sfb_skb_cb *sfb_skb_cb(const struct sk_buff *skb) | 95 | static inline struct sfb_skb_cb *sfb_skb_cb(const struct sk_buff *skb) |
96 | { | 96 | { |
97 | BUILD_BUG_ON(sizeof(skb->cb) < | 97 | qdisc_cb_private_validate(skb, sizeof(struct sfb_skb_cb)); |
98 | sizeof(struct qdisc_skb_cb) + sizeof(struct sfb_skb_cb)); | ||
99 | return (struct sfb_skb_cb *)qdisc_skb_cb(skb)->data; | 98 | return (struct sfb_skb_cb *)qdisc_skb_cb(skb)->data; |
100 | } | 99 | } |
101 | 100 | ||
diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c index 67494aef9acf..60d47180f043 100644 --- a/net/sched/sch_sfq.c +++ b/net/sched/sch_sfq.c | |||
@@ -166,9 +166,8 @@ struct sfq_skb_cb { | |||
166 | 166 | ||
167 | static inline struct sfq_skb_cb *sfq_skb_cb(const struct sk_buff *skb) | 167 | static inline struct sfq_skb_cb *sfq_skb_cb(const struct sk_buff *skb) |
168 | { | 168 | { |
169 | BUILD_BUG_ON(sizeof(skb->cb) < | 169 | qdisc_cb_private_validate(skb, sizeof(struct sfq_skb_cb)); |
170 | sizeof(struct qdisc_skb_cb) + sizeof(struct sfq_skb_cb)); | 170 | return (struct sfq_skb_cb *)qdisc_skb_cb(skb)->data; |
171 | return (struct sfq_skb_cb *)qdisc_skb_cb(skb)->data; | ||
172 | } | 171 | } |
173 | 172 | ||
174 | static unsigned int sfq_hash(const struct sfq_sched_data *q, | 173 | static unsigned int sfq_hash(const struct sfq_sched_data *q, |