All of lore.kernel.org
 help / color / mirror / Atom feed
From: ChenXiaoSong <chenxiaosong.chenxiaosong@linux.dev>
To: Paulo Alcantara <pc@manguebit.org>, smfrench@gmail.com
Cc: David Howells <dhowells@redhat.com>, linux-cifs@vger.kernel.org
Subject: Re: [PATCH] smb: client: fix potential UAF and double free it smb2_open_file()
Date: Fri, 6 Feb 2026 02:41:45 +0800	[thread overview]
Message-ID: <cbedb833-0cf9-467e-8751-e975b965c467@linux.dev> (raw)
In-Reply-To: <20260205161952.245146-1-pc@manguebit.org>

Looks good. Feel free to add:

Reviewed-by: ChenXiaoSong <chenxiaosong@kylinos.cn>

On 2/6/26 12:19 AM, Paulo Alcantara wrote:
> Zero out @err_iov and @err_buftype before retrying SMB2_open() to
> prevent an UAF bug if @data != NULL, otherwise a double free.
> 
> Fixes: e3a43633023e ("smb/client: fix memory leak in smb2_open_file()")
> Reported-by: David Howells <dhowells@redhat.com>
> Closes: https://lore.kernel.org/r/2892312.1770306653@warthog.procyon.org.uk
> Signed-off-by: Paulo Alcantara (Red Hat) <pc@manguebit.org>
> Reviewed-by: David Howells <dhowells@redhat.com>
> Cc: ChenXiaoSong <chenxiaosong@kylinos.cn>
> Cc: linux-cifs@vger.kernel.org
> ---
>   fs/smb/client/smb2file.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/fs/smb/client/smb2file.c b/fs/smb/client/smb2file.c
> index 2dd08388ea87..1f7f284a7844 100644
> --- a/fs/smb/client/smb2file.c
> +++ b/fs/smb/client/smb2file.c
> @@ -179,6 +179,8 @@ int smb2_open_file(const unsigned int xid, struct cifs_open_parms *oparms,
>   		       &err_buftype);
>   	if (rc == -EACCES && retry_without_read_attributes) {
>   		free_rsp_buf(err_buftype, err_iov.iov_base);
> +		memset(&err_iov, 0, sizeof(err_iov));
> +		err_buftype = CIFS_NO_BUFFER;
>   		oparms->desired_access &= ~FILE_READ_ATTRIBUTES;
>   		rc = SMB2_open(xid, oparms, smb2_path, &smb2_oplock, smb2_data, NULL, &err_iov,
>   			       &err_buftype);


  reply	other threads:[~2026-02-05 18:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-05 16:19 [PATCH] smb: client: fix potential UAF and double free it smb2_open_file() Paulo Alcantara
2026-02-05 18:41 ` ChenXiaoSong [this message]
2026-02-05 19:10 ` ChenXiaoSong
2026-02-05 19:15   ` Steve French
2026-02-05 20:13 ` Steve French

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=cbedb833-0cf9-467e-8751-e975b965c467@linux.dev \
    --to=chenxiaosong.chenxiaosong@linux.dev \
    --cc=dhowells@redhat.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=pc@manguebit.org \
    --cc=smfrench@gmail.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.