[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87sed12rte.fsf@wotan.olymp>
Date: Tue, 23 Dec 2025 14:31:09 +0000
From: Luis Henriques <luis@...lia.com>
To: Al Viro <viro@...iv.linux.org.uk>
Cc: Miklos Szeredi <miklos@...redi.hu>, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org, kernel-dev@...lia.com
Subject: Re: [PATCH] fuse: add missing iput() in fuse_lookup() error path
On Fri, Dec 19 2025, Al Viro wrote:
> On Fri, Dec 19, 2025 at 05:43:09PM +0000, Luis Henriques wrote:
>> The inode use count needs to be dropped in the fuse_lookup() error path,
>> when there's an error returned by d_splice_alias().
>>
>> (While there, remove extra white spaces before labels.)
>>
>> Fixes: 5835f3390e35 ("fuse: use d_materialise_unique()")
>> Signed-off-by: Luis Henriques <luis@...lia.com>
>
> Have you actually looked at d_splice_alias()?
>
> It does consume inode reference in all cases, success or error. On success
> it gets transferred to dentry; on failure it is dropped. That's quite
> deliberate, since it makes life much simplier for failure handling in the
> callers.
>
> If you can reproduce a leak there, I would like to see a reproducer.
> If not, I would say that your patch introduces a double-iput.
>
> NAK.
Totally deserved :-(
To be honest, while investigating this I remember finding the following in
d_obtain_alias() documentation:
On successful return, the reference to the inode has been transferred
to the dentry. In case of an error the reference on the inode is released.
Since d_splice_alias() didn't included that note explicitly, I (wrongly)
assumed it would *not* consume the reference. Sure, I did had a look at
the function, but clearly not close enough.
Sorry for wasting your time, and thank you for the explanation.
Cheers,
--
Luís
Powered by blists - more mailing lists