All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luis Henriques <luis@igalia.com>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: Miklos Szeredi <miklos@szeredi.hu>,
	 linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	 kernel-janitors@vger.kernel.org
Subject: Re: [PATCH next] fuse: Uninitialized variable in fuse_epoch_work()
Date: Sat, 22 Nov 2025 10:23:31 +0000	[thread overview]
Message-ID: <87ms4ez7q4.fsf@wotan.olymp> (raw)
In-Reply-To: <aSCkt-DZR7A8U1y7@stanley.mountain> (Dan Carpenter's message of "Fri, 21 Nov 2025 20:43:19 +0300")

On Fri, Nov 21 2025, Dan Carpenter wrote:

> On Fri, Nov 21, 2025 at 01:53:48PM +0000, Luis Henriques wrote:
>> On Fri, Nov 21 2025, Dan Carpenter wrote:
>> 
>> > The "fm" pointer is either valid or uninitialized so checking for NULL
>> > doesn't work.  Check the "inode" pointer instead.
>> 
>> Hmm?  Why do you say 'fm' isn't initialised?  That's what fuse_ilookup()
>> is doing, isn't it?
>> 
>
> I just checked again on linux-next.  fuse_ilookup() only initializes
> *fm on the success path.  It's either uninitialized or valid.

Yikes! You're absolutely right, I'm sorry for replying without checking.

Feel free to add my

Reviewed-by: Luis Henriques <luis@igalia.com>

Although I guess you're patch could also move the iput():

diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 67e3340a443c..f2bac7b3a125 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

And thanks for your fix, Dan!

Cheers,
-- 
Luís

  reply	other threads:[~2025-11-22 10:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-21 13:34 [PATCH next] fuse: Uninitialized variable in fuse_epoch_work() Dan Carpenter
2025-11-21 13:53 ` Luis Henriques
2025-11-21 17:43   ` Dan Carpenter
2025-11-22 10:23     ` Luis Henriques [this message]
2025-11-24  6:05       ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ms4ez7q4.fsf@wotan.olymp \
    --to=luis@igalia.com \
    --cc=dan.carpenter@linaro.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.