]> git.baikalelectronics.ru Git - kernel.git/commit
net_sched: keep alloc_hash updated after hash allocation
authorCong Wang <xiyou.wangcong@gmail.com>
Thu, 12 Mar 2020 05:42:28 +0000 (22:42 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sun, 15 Mar 2020 03:42:29 +0000 (20:42 -0700)
commit03c8b67e8b9a662f90a8bfd9e88b7914c05bfa0c
tree1ca4f09dcc9693bee688b569f344b4d4f5c7846f
parenta50f657bf66e1ccc9e7f07f2232a9d47578bfd3e
net_sched: keep alloc_hash updated after hash allocation

In commit 3165b40808f5 ("net_sched: fix an OOB access in cls_tcindex")
I moved cp->hash calculation before the first
tcindex_alloc_perfect_hash(), but cp->alloc_hash is left untouched.
This difference could lead to another out of bound access.

cp->alloc_hash should always be the size allocated, we should
update it after this tcindex_alloc_perfect_hash().

Reported-and-tested-by: syzbot+dcc34d54d68ef7d2d53d@syzkaller.appspotmail.com
Reported-and-tested-by: syzbot+c72da7b9ed57cde6fca2@syzkaller.appspotmail.com
Fixes: 3165b40808f5 ("net_sched: fix an OOB access in cls_tcindex")
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/cls_tcindex.c