git: e5a2e7735244 - main - inotify: Fix a namei path buffer leak

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Thu, 14 Aug 2025 16:04:53 UTC
The branch main has been updated by markj:

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

commit e5a2e77352440f23ef8988a934753fd2fba8b821
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2025-08-14 16:03:00 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2025-08-14 16:03:00 +0000

    inotify: Fix a namei path buffer leak
    
    Reviewed by:    kib
    Fixes:          f1f230439fa4 ("vfs: Initial revision of inotify")
    Differential Revision:  https://reviews.freebsd.org/D51900
---
 sys/kern/vfs_inotify.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sys/kern/vfs_inotify.c b/sys/kern/vfs_inotify.c
index 746a5a39208e..b265a5ff3a62 100644
--- a/sys/kern/vfs_inotify.c
+++ b/sys/kern/vfs_inotify.c
@@ -801,6 +801,7 @@ vn_inotify_add_watch(struct vnode *vp, struct inotify_softc *sc, uint32_t mask,
 			vn_lock(vp, LK_SHARED | LK_RETRY);
 			if (error != 0)
 				break;
+			NDFREE_PNBUF(&nd);
 			vn_irflag_set_cond(nd.ni_vp, VIRF_INOTIFY_PARENT);
 			vrele(nd.ni_vp);
 		}