From: Paulo Alcantara <pc@manguebit.org>
To: Fredric Cover <fredric.cover.lkernel@gmail.com>,
Namjae Jeon <linkinjeon@kernel.org>
Cc: ChenXiaoSong <chenxiaosong@chenxiaosong.com>,
Tom Talpey <tom@talpey.com>,
Ronnie Sahlberg <ronniesahlberg@gmail.com>,
Shyam Prasad N <sprasad@microsoft.com>,
Bharath SM <bharathsm@microsoft.com>,
linux-cifs@vger.kernel.org, linux-kernel@vger.kernel.org,
Fredric Cover <fredric.cover.lkernel@gmail.com>
Subject: Re: [PATCH 2/2] smb: client: prevent out-of-bounds dfs_info3_param access in copy_ref_data()
Date: Wed, 02 Sep 2026 14:35:56 -0300 [thread overview]
Message-ID: <7afd24a483fc59d9217cefbab526bccf@manguebit.org> (raw)
In-Reply-To: <20260826191033.162320-3-fredric.cover.lkernel@gmail.com>
Fredric Cover <fredric.cover.lkernel@gmail.com> writes:
> Currently, copy_ref_data() assumes that numrefs > 0, and unconditinally
> accesses refs[0]. If copy_ref_data() somehow is passed an empty list,
> this would cause major out-of-bounds write and read problems.
>
> Enforce numrefs > 0.
>
> Signed-off-by: Fredric Cover <fredric.cover.lkernel@gmail.com>
> ---
> fs/smb/client/dfs_cache.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/fs/smb/client/dfs_cache.c b/fs/smb/client/dfs_cache.c
> index b0388c460499..b51c8355d73d 100644
> --- a/fs/smb/client/dfs_cache.c
> +++ b/fs/smb/client/dfs_cache.c
> @@ -389,6 +389,9 @@ static int copy_ref_data(const struct dfs_info3_param *refs, int numrefs,
> struct cache_dfs_tgt *target;
> int i;
>
> + if (WARN_ON_ONCE(numrefs <= 0))
> + return -EINVAL;
I don't understand why this check is necessary. All target referrals
come from get_dfs_referral(), and in case @numrefs < 0,
parse_dfs_referrals() would have returned -ENOENT and copy_ref_data()
wouldn't be called.
next prev parent reply other threads:[~2026-09-02 17:35 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-26 19:10 [PATCH 0/2] smb: client: improve copy_ref_data() robustness Fredric Cover
2026-08-26 19:10 ` [PATCH 1/2] smb: client: fill cache fields after populating cache in copy_ref_data() Fredric Cover
2026-09-02 16:55 ` Paulo Alcantara
2026-08-26 19:10 ` [PATCH 2/2] smb: client: prevent out-of-bounds dfs_info3_param access " Fredric Cover
2026-09-02 17:35 ` Paulo Alcantara [this message]
[not found] ` <notmuch-sha1-3e5d257ab3acfa72da7284e13dd0c817fac4b88c>
2026-09-02 17:48 ` Paulo Alcantara
2026-09-02 23:56 ` Fredric Cover
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=7afd24a483fc59d9217cefbab526bccf@manguebit.org \
--to=pc@manguebit.org \
--cc=bharathsm@microsoft.com \
--cc=chenxiaosong@chenxiaosong.com \
--cc=fredric.cover.lkernel@gmail.com \
--cc=linkinjeon@kernel.org \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ronniesahlberg@gmail.com \
--cc=sprasad@microsoft.com \
--cc=tom@talpey.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 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.