From: Paulo Alcantara <pc@manguebit.org>
To: Frank Sorenson <sorenson@redhat.com>,
linux-cifs@vger.kernel.org, stfrench@microsoft.com
Cc: stable@vger.kernel.org, Paulo Alcantara <pc@manguebit.com>
Subject: Re: [PATCH v2 1/3] cifs: clear tcon after cifsFileInfo_put() in cifs_file_set_size()
Date: Fri, 21 Aug 2026 13:47:51 -0300 [thread overview]
Message-ID: <7bdd71d4092fe74f58bedc74e0e316f9@manguebit.org> (raw)
In-Reply-To: <20260807024158.3707995-2-sorenson@redhat.com>
Frank Sorenson <sorenson@redhat.com> writes:
> When the else branch of cifs_file_set_size() finds a writable file handle
> via find_writable_file(), it borrows tcon and server from the handle's
> tlink, attempts the handle-based set_file_size() RPC, and then releases
> the handle with cifsFileInfo_put().
>
> If set_file_size() fails, execution falls through to the path-based
> fallback, which reuses the borrowed tcon and server under the
> "if (tcon == NULL)" guard. Since tcon is not NULL at that point, the
> guard is skipped. If cifsFileInfo_put() dropped the last reference on a
> tlink that was already removed from the tlink tree (TCON_LINK_IN_TREE
> cleared, as happens during reconnection or session teardown),
> cifs_put_tlink() will have freed tcon; the subsequent set_path_size()
> call is then a use-after-free.
>
> Setting tcon = NULL after cifsFileInfo_put() causes the existing guard
> to take the cifs_sb_tlink() path, which acquires a fresh reference for
> the path-based operation or fails cleanly if the session is gone.
> ...
Applied.
next prev parent reply other threads:[~2026-08-21 16:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-07 2:41 [PATCH v2 0/3] cifs: three size-management bug fixes Frank Sorenson
2026-08-07 2:41 ` [PATCH v2 1/3] cifs: clear tcon after cifsFileInfo_put() in cifs_file_set_size() Frank Sorenson
2026-08-21 16:47 ` Paulo Alcantara [this message]
2026-08-07 2:41 ` [PATCH v2 2/3] cifs: don't update i_size in cifs_do_truncate() without a cached handle Frank Sorenson
2026-08-07 2:41 ` [PATCH v2 3/3] cifs: fix loff_t underflow in cifs_remap_file_range() when len == 0 Frank Sorenson
2026-08-07 11:06 ` [PATCH v2 0/3] cifs: three size-management bug fixes Frank Sorenson
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=7bdd71d4092fe74f58bedc74e0e316f9@manguebit.org \
--to=pc@manguebit.org \
--cc=linux-cifs@vger.kernel.org \
--cc=pc@manguebit.com \
--cc=sorenson@redhat.com \
--cc=stable@vger.kernel.org \
--cc=stfrench@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