From d0a032833e148e63aad8a4916137e1a84b01c01f Mon Sep 17 00:00:00 2001 From: dlg Date: Fri, 23 Apr 2021 03:43:19 +0000 Subject: [PATCH] call klist_invalidate from bpfsdetach to tell kq listeners what happened. without this, something using a kevent to monitor a bpf fd on an idle interface never has the event fire, which means it never realises the interface goes away. with this, the read event goes off and the next read fails with EIO, like pretty much every other driver when the underlying device is removed. ok claudio@ visa@ jmatthew@ --- sys/net/bpf.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/net/bpf.c b/sys/net/bpf.c index fccc985e6d3..b78067a5428 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bpf.c,v 1.203 2021/01/21 12:33:14 dlg Exp $ */ +/* $OpenBSD: bpf.c,v 1.204 2021/04/23 03:43:19 dlg Exp $ */ /* $NetBSD: bpf.c,v 1.33 1997/02/21 23:59:35 thorpej Exp $ */ /* @@ -1690,8 +1690,10 @@ bpfsdetach(void *p) if (cdevsw[maj].d_open == bpfopen) break; - while ((bd = SMR_SLIST_FIRST_LOCKED(&bp->bif_dlist))) + while ((bd = SMR_SLIST_FIRST_LOCKED(&bp->bif_dlist))) { vdevgone(maj, bd->bd_unit, bd->bd_unit, VCHR); + klist_invalidate(&bd->bd_sel.si_note); + } for (tbp = bpf_iflist; tbp; tbp = tbp->bif_next) { if (tbp->bif_next == bp) { -- 2.20.1