]> git.baikalelectronics.ru Git - kernel.git/commit
af_packet: fix tracking issues in packet_do_bind()
authorEric Dumazet <edumazet@google.com>
Fri, 7 Jan 2022 18:39:53 +0000 (10:39 -0800)
committerJakub Kicinski <kuba@kernel.org>
Sat, 8 Jan 2022 03:11:55 +0000 (19:11 -0800)
commitf217544ec82823883a17a2a907548540082cb607
treec693e0915fe5444ecc81f982fbfbcbcb6ffe5db4
parent4d005801d5e1dbe1bf0b01bab433187ec065eece
af_packet: fix tracking issues in packet_do_bind()

It appears that my changes in packet_do_bind() were
slightly wrong.

syzbot found that calling bind() twice would trigger
a false positive.

Remove proto_curr/dev_curr variables and rewrite things
to be less confusing (like not having to use netdev_tracker_alloc(),
and instead use the standard dev_hold_track())

Fixes: 5f1b96644de5 ("net: add net device refcount tracker to struct packet_type")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: syzbot <syzkaller@googlegroups.com>
Link: https://lore.kernel.org/r/20220107183953.3886647-1-eric.dumazet@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/packet/af_packet.c