diff options
author | Eric Dumazet <edumazet@google.com> | 2013-06-02 07:15:55 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-06-07 18:24:04 -0400 |
commit | 40edeff6e1c6f9a6f16536ae3375e3af9d648449 (patch) | |
tree | 10b78f0fe8fec830ba2cafae2be4e6dfdc0adc21 /net | |
parent | 1612e111e4e565422242727efb59499cce8738e4 (diff) |
net_sched: qdisc_get_rtab() must check data[] array
qdisc_get_rtab() should check not only the keys in struct tc_ratespec,
but also the full data[] array.
"tc ... linklayer atm " only perturbs values in the 256 slots array.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/sched/sch_api.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index 2b935e7cfe7b..281c1bded1f6 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c | |||
@@ -291,17 +291,18 @@ struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r, struct nlattr *ta | |||
291 | { | 291 | { |
292 | struct qdisc_rate_table *rtab; | 292 | struct qdisc_rate_table *rtab; |
293 | 293 | ||
294 | if (tab == NULL || r->rate == 0 || r->cell_log == 0 || | ||
295 | nla_len(tab) != TC_RTAB_SIZE) | ||
296 | return NULL; | ||
297 | |||
294 | for (rtab = qdisc_rtab_list; rtab; rtab = rtab->next) { | 298 | for (rtab = qdisc_rtab_list; rtab; rtab = rtab->next) { |
295 | if (memcmp(&rtab->rate, r, sizeof(struct tc_ratespec)) == 0) { | 299 | if (!memcmp(&rtab->rate, r, sizeof(struct tc_ratespec)) && |
300 | !memcmp(&rtab->data, nla_data(tab), 1024)) { | ||
296 | rtab->refcnt++; | 301 | rtab->refcnt++; |
297 | return rtab; | 302 | return rtab; |
298 | } | 303 | } |
299 | } | 304 | } |
300 | 305 | ||
301 | if (tab == NULL || r->rate == 0 || r->cell_log == 0 || | ||
302 | nla_len(tab) != TC_RTAB_SIZE) | ||
303 | return NULL; | ||
304 | |||
305 | rtab = kmalloc(sizeof(*rtab), GFP_KERNEL); | 306 | rtab = kmalloc(sizeof(*rtab), GFP_KERNEL); |
306 | if (rtab) { | 307 | if (rtab) { |
307 | rtab->rate = *r; | 308 | rtab->rate = *r; |