Skip to contentSkip to conversation

fuse: Uninitialized variable in fuse_epoch_work()

PATCH Applied Dan Carpenter 2 participants 2 messages Nov 24, 2025 – Nov 26, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 fuse: Uninitialized variable in fuse_epoch_work()

The fuse_ilookup() function only sets *fm on the success path so this "if (fm) {" NULL check doesn't work. The "fm" pointer is either uninitialized or valid. Check the "inode" pointer instead.

Also, while it's not necessary, it is cleaner to move the iput(inode) under the NULL check as well.

Fixes 64becd224ff9 ("fuse: new work queue to invalidate dentries from old epochs")

---
v2: Move the iput(inode) and re-word the commit message

 fs/fuse/dir.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
fs/fuse/dir.c +2 -3
index 761f4a14dc95..73a46b0be09d 100644
@@ -199,9 +199,8 @@ void fuse_epoch_work(struct work_struct *work)
 	down_read(&fc->killsb);
 
 	inode = fuse_ilookup(fc, FUSE_ROOT_ID, &fm);
-	iput(inode);
-
-	if (fm) {
+	if (inode) {
+		iput(inode);
 		/* Remove all possible active references to cached inodes */
 		shrink_dcache_sb(fm->sb);
 	} else
Signature · 1 line
2.51.0
maintainer Applied
#1 lore raw
Quoted 11 lines · Dan Carpenter

The fuse_ilookup() function only sets *fm on the success path so this "if (fm) {" NULL check doesn't work. The "fm" pointer is either uninitialized or valid. Check the "inode" pointer instead.

Also, while it's not necessary, it is cleaner to move the iput(inode) under the NULL check as well.

Fixes 64becd224ff9 ("fuse: new work queue to invalidate dentries from old epochs")

Applied, thanks.

Miklos