]> git.baikalelectronics.ru Git - kernel.git/commit
net/packet: rx_owner_map depends on pg_vec
authorWillem de Bruijn <willemb@google.com>
Wed, 15 Dec 2021 14:39:37 +0000 (09:39 -0500)
committerJakub Kicinski <kuba@kernel.org>
Thu, 16 Dec 2021 01:49:36 +0000 (17:49 -0800)
commit1db62c04b83338ba2cf2fc010bedf3087d816f9b
tree907fc24cb8efc985e2475143b9e905bd6c99acd2
parent1c7aeb6a1b9e097062c0c01474ab742299c503eb
net/packet: rx_owner_map depends on pg_vec

Packet sockets may switch ring versions. Avoid misinterpreting state
between versions, whose fields share a union. rx_owner_map is only
allocated with a packet ring (pg_vec) and both are swapped together.
If pg_vec is NULL, meaning no packet ring was allocated, then neither
was rx_owner_map. And the field may be old state from a tpacket_v3.

Fixes: 6b1d969bc861 ("net/packet: tpacket_rcv: avoid a producer race condition")
Reported-by: Syzbot <syzbot+1ac0994a0a0c55151121@syzkaller.appspotmail.com>
Signed-off-by: Willem de Bruijn <willemb@google.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link: https://lore.kernel.org/r/20211215143937.106178-1-willemdebruijn.kernel@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/packet/af_packet.c