git: 3a12ea648f3b - stable/13 - freevnode(): lock the freeing vnode around destroy_vpollinfo()

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Fri, 19 Nov 2021 04:36:50 UTC
The branch stable/13 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=3a12ea648f3b9a7de4fe08a3a9d3ea6d025e8f07

commit 3a12ea648f3b9a7de4fe08a3a9d3ea6d025e8f07
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2021-11-02 02:49:13 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2021-11-19 04:25:29 +0000

    freevnode(): lock the freeing vnode around destroy_vpollinfo()
    
    (cherry picked from commit d1d675cb304c3cca824fbc9f932dc9d655b1ad24)
---
 sys/kern/vfs_subr.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index da2f90a44d86..ce1f4ed6126e 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -1920,7 +1920,9 @@ freevnode(struct vnode *vp)
 	mac_vnode_destroy(vp);
 #endif
 	if (vp->v_pollinfo != NULL) {
+		vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 		destroy_vpollinfo(vp->v_pollinfo);
+		VOP_UNLOCK(vp);
 		vp->v_pollinfo = NULL;
 	}
 	vp->v_mountedhere = NULL;