Module Name: src Committed By: riastradh Date: Sun Mar 13 21:32:35 UTC 2022
Modified Files: src/sys/net: if_tun.c Log Message: tun(4): Deliver SIGIO for hangup under tun_lock. Otherwise, tp->tun_pgid is not stable. To generate a diff of this commit: cvs rdiff -u -r1.168 -r1.169 src/sys/net/if_tun.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/net/if_tun.c diff -u src/sys/net/if_tun.c:1.168 src/sys/net/if_tun.c:1.169 --- src/sys/net/if_tun.c:1.168 Sun Mar 13 21:32:27 2022 +++ src/sys/net/if_tun.c Sun Mar 13 21:32:35 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: if_tun.c,v 1.168 2022/03/13 21:32:27 riastradh Exp $ */ +/* $NetBSD: if_tun.c,v 1.169 2022/03/13 21:32:35 riastradh Exp $ */ /* * Copyright (c) 1988, Julian Onions <j...@cs.nott.ac.uk> @@ -19,7 +19,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_tun.c,v 1.168 2022/03/13 21:32:27 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_tun.c,v 1.169 2022/03/13 21:32:35 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -334,12 +334,10 @@ tun_clone_destroy(struct ifnet *ifp) tp->tun_flags &= ~TUN_RWAIT; cv_broadcast(&tp->tun_cv); } - selnotify(&tp->tun_rsel, 0, NOTE_SUBMIT); - - mutex_exit(&tp->tun_lock); - if (tp->tun_flags & TUN_ASYNC && tp->tun_pgid) fownsignal(tp->tun_pgid, SIGIO, POLL_HUP, 0, NULL); + selnotify(&tp->tun_rsel, 0, NOTE_SUBMIT); + mutex_exit(&tp->tun_lock); bpf_detach(ifp); if_detach(ifp);