HomeFreeBSD

[udp6] fix possible panic due to lack of locking.

Description

[udp6] fix possible panic due to lack of locking.

The lookup for a IPv6 multicast addresses corresponding to
the destination address in the datagram is protected by the
NET_EPOCH section. Access to each PCB is protected by INP_RLOCK
during comparing. But access to socket's so_options field is
not protected. And in some cases it is possible, that PCB
pointer is still valid, but inp_socket is not. The patch wides
lock holding to protect access to inp_socket. It copies locking
strategy from IPv4 UDP handling.

PR: 232192
Approved by: re (gjb)
Obtained from: Yandex LLC
Sponsored by: Yandex LLC
Differential Revision: https://reviews.freebsd.org/D28232

(cherry picked from commit 3c782d9c91666886d868426f0aea040d1a1a8ee4)
(cherry picked from commit 8cb4c363163062bceec92383eae43f5a32049c73)

Details

Provenance
aeAuthored on Feb 11 2021, 8:38 AM
Differential Revision
D28232: Fix possible panic in udp6_input() due to lack of locking.
Parents
rGf28545524cb1: ifconfig: fix incorrect wg allowed-ips netmask
Branches
Unknown
Tags
Unknown