OSDN Git Service

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)
commitbf44077c1b3ae86668bce02d9466e7134a6569ec
treec693e0915fe5444ecc81f982fbfbcbcb6ffe5db4
parentd8caa2ed47de0e55828a3bd0a81bbb81aa9e7e11
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: f1d9268e0618 ("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