]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
bpf: Fix BIOCPROMISC locking
authorMark Johnston <markj@FreeBSD.org>
Fri, 5 Aug 2022 20:25:05 +0000 (16:25 -0400)
committerMark Johnston <markj@FreeBSD.org>
Fri, 5 Aug 2022 20:26:34 +0000 (16:26 -0400)
commit220818ac030726c24cbf9df6df5c9d019993b875
tree17f10d7d044770ab34b83395482e43234a5510e5
parente9552d8b45d67ca44d91b3ec09c91253e7e99b28
bpf: Fix BIOCPROMISC locking

BPF might put an interface in promiscuous mode when handling the
BIOCSDLT ioctl.  When this happens, a flag is set in the BPF descriptor
so that the old interface can be restored when the BPF descriptor is
destroyed.

The BIOCPROMISC ioctl can also be used to put a BPF descriptor's
interface into promiscuous mode, but there was nothing synchronizing the
flag.  Fix this by modifying the ioctl handler to acquire the global BPF
mutex, which is used to synchronize ifpromisc() calls elsewhere in BPF.

Reviewed by: kp, melifaro
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36045
sys/net/bpf.c