]> Git Repo - linux.git/commit
net_sched: fix an OOB access in cls_tcindex
authorCong Wang <[email protected]>
Mon, 3 Feb 2020 05:14:35 +0000 (21:14 -0800)
committerDavid S. Miller <[email protected]>
Tue, 4 Feb 2020 10:41:36 +0000 (11:41 +0100)
commit599be01ee567b61f4471ee8078870847d0a11e8e
tree62799958894ec43c807a2da72a1a93d0471fc7ee
parent83b43045308ea0600099830292955f18818f8d5e
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: [email protected]
Fixes: 331b72922c5f ("net: sched: RCU cls_tcindex")
Cc: Eric Dumazet <[email protected]>
Cc: John Fastabend <[email protected]>
Cc: Jamal Hadi Salim <[email protected]>
Cc: Jiri Pirko <[email protected]>
Cc: Jakub Kicinski <[email protected]>
Signed-off-by: Cong Wang <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
net/sched/cls_tcindex.c
This page took 0.071414 seconds and 4 git commands to generate.