linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] fuse: Uninitialized variable in fuse_epoch_work()
@ 2025-11-24  6:04 Dan Carpenter
  2025-11-26 11:47 ` Miklos Szeredi
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2025-11-24  6:04 UTC (permalink / raw)
  To: Luis Henriques
  Cc: Miklos Szeredi, linux-fsdevel, linux-kernel, kernel-janitors

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")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Luis Henriques <luis@igalia.com>
---
v2: Move the iput(inode) and re-word the commit message

 fs/fuse/dir.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 761f4a14dc95..73a46b0be09d 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -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
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] fuse: Uninitialized variable in fuse_epoch_work()
  2025-11-24  6:04 [PATCH v2] fuse: Uninitialized variable in fuse_epoch_work() Dan Carpenter
@ 2025-11-26 11:47 ` Miklos Szeredi
  0 siblings, 0 replies; 2+ messages in thread
From: Miklos Szeredi @ 2025-11-26 11:47 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Luis Henriques, linux-fsdevel, linux-kernel, kernel-janitors

On Mon, 24 Nov 2025 at 07:05, Dan Carpenter <dan.carpenter@linaro.org> wrote:
>
> 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")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> Reviewed-by: Luis Henriques <luis@igalia.com>

Applied, thanks.

Miklos

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-11-26 11:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-24  6:04 [PATCH v2] fuse: Uninitialized variable in fuse_epoch_work() Dan Carpenter
2025-11-26 11:47 ` Miklos Szeredi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).