diff options
author | Cong Wang <xiyou.wangcong@gmail.com> | 2020-02-02 21:14:35 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-02-04 11:41:36 +0100 |
commit | 599be01ee567b61f4471ee8078870847d0a11e8e (patch) | |
tree | 62799958894ec43c807a2da72a1a93d0471fc7ee /drivers/net/usb/r8152.c | |
parent | qed: Remove set but not used variable 'p_link' (diff) | |
download | linux-dev-599be01ee567b61f4471ee8078870847d0a11e8e.tar.xz linux-dev-599be01ee567b61f4471ee8078870847d0a11e8e.zip |
net_sched: fix an OOB access in cls_tcindex
As Eric noticed, tcindex_alloc_perfect_hash() uses cp->hash
to compute the size of memory allocation, but cp->hash is
set again after the allocation, this caused an out-of-bound
access.
So we have to move all cp->hash initialization and computation
before the memory allocation. Move cp->mask and cp->shift together
as cp->hash may need them for computation too.
Reported-and-tested-by: syzbot+35d4dea36c387813ed31@syzkaller.appspotmail.com
Fixes: 331b72922c5f ("net: sched: RCU cls_tcindex")
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: John Fastabend <john.fastabend@gmail.com>
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: Jiri Pirko <jiri@resnulli.us>
Cc: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to '')
0 files changed, 0 insertions, 0 deletions