]> git.baikalelectronics.ru Git - kernel.git/commit
net_sched: fix datalen for ematch
authorCong Wang <xiyou.wangcong@gmail.com>
Wed, 22 Jan 2020 23:42:02 +0000 (15:42 -0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 23 Jan 2020 20:34:42 +0000 (21:34 +0100)
commitdab69fe01122e4be74906a512492bd7b9895697a
treef3a4b4805448da26fd0d43423a0ae0c2905e4d98
parent4816e98a9262aee3be1068ebf4e5642a7bc20193
net_sched: fix datalen for ematch

syzbot reported an out-of-bound access in em_nbyte. As initially
analyzed by Eric, this is because em_nbyte sets its own em->datalen
in em_nbyte_change() other than the one specified by user, but this
value gets overwritten later by its caller tcf_em_validate().
We should leave em->datalen untouched to respect their choices.

I audit all the in-tree ematch users, all of those implement
->change() set em->datalen, so we can just avoid setting it twice
in this case.

Reported-and-tested-by: syzbot+5af9a90dad568aa9f611@syzkaller.appspotmail.com
Reported-by: syzbot+2f07903a5b05e7f36410@syzkaller.appspotmail.com
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/ematch.c