Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: Paulo Alcantara <pc@manguebit.com>
To: Henrique Carvalho <henrique.carvalho@suse.com>
Cc: smfrench@gmail.com, ematsumiya@suse.de, sprasad@microsoft.com,
	paul@darkrain42.org, bharathsm@microsoft.com,
	linux-cifs@vger.kernel.org
Subject: Re: [PATCH v3] smb: client: fix race in smb2_close_cached_fid()
Date: Tue, 27 May 2025 16:29:13 -0300	[thread overview]
Message-ID: <d3e68ea1c2db713c80eef6fba357f765@manguebit.com> (raw)
In-Reply-To: <aDYQILpDA0EqzsX7@precision>

Henrique Carvalho <henrique.carvalho@suse.com> writes:

> On Tue, May 27, 2025 at 04:06:01PM -0300, Paulo Alcantara wrote:
>> Henrique Carvalho <henrique.carvalho@suse.com> writes:
>> 
>> > find_or_create_cached_dir() could grab a new reference after kref_put()
>> > had seen the refcount drop to zero but before cfid_list_lock is acquired
>> > in smb2_close_cached_fid(), leading to use-after-free.
>> >
>> > Switch to kref_put_lock() so cfid_release() runs with cfid_list_lock
>> > held, closing that gap.
>> 
>> Does this mean that SMB2_close() will be called with @cfid_list_lock
>> held?  If so, that's wrong.
>
> What I mean here is "Switch to kref_put_lock() so
> smb2_close_cached_fid() *IS CALLED* with cfid_list_lock held". Poor
> wording on my part.
>
> The lock will be released after cfid is removed from list.

Awesome, thanks for making it clearer.

      reply	other threads:[~2025-05-27 19:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-27 18:42 [PATCH v3] smb: client: fix race in smb2_close_cached_fid() Henrique Carvalho
2025-05-27 19:06 ` Paulo Alcantara
2025-05-27 19:18   ` Henrique Carvalho
2025-05-27 19:29     ` Paulo Alcantara [this message]

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=d3e68ea1c2db713c80eef6fba357f765@manguebit.com \
    --to=pc@manguebit.com \
    --cc=bharathsm@microsoft.com \
    --cc=ematsumiya@suse.de \
    --cc=henrique.carvalho@suse.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=paul@darkrain42.org \
    --cc=smfrench@gmail.com \
    --cc=sprasad@microsoft.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox