linux-cifs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fs: smb: client: Reset password pointer to NULL
@ 2024-01-18  7:43 Fullway Wang
  2024-02-10  5:46 ` Steve French
  0 siblings, 1 reply; 2+ messages in thread
From: Fullway Wang @ 2024-01-18  7:43 UTC (permalink / raw)
  To: sfrench, pc, lsahlber, sprasad
  Cc: linux-cifs, linux-kernel, fullwaywang, Fullway Wang

ctx->password was freed but not reset to NULL, which may lead to double
free and secrets leak issues.

This is similar to CVE-2023-5345, which was fixed in commit e6e43b8.

Signed-off-by: Fullway Wang <fullwaywang@outlook.com>
---
 fs/smb/client/connect.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c
index 3052a208c6ca..fb96a234b9b1 100644
--- a/fs/smb/client/connect.c
+++ b/fs/smb/client/connect.c
@@ -4028,6 +4028,7 @@ cifs_construct_tcon(struct cifs_sb_info *cifs_sb, kuid_t fsuid)
 out:
 	kfree(ctx->username);
 	kfree_sensitive(ctx->password);
+	ctx->password = NULL;
 	kfree(ctx);
 
 	return tcon;
-- 
2.39.3 (Apple Git-145)


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] fs: smb: client: Reset password pointer to NULL
  2024-01-18  7:43 [PATCH] fs: smb: client: Reset password pointer to NULL Fullway Wang
@ 2024-02-10  5:46 ` Steve French
  0 siblings, 0 replies; 2+ messages in thread
From: Steve French @ 2024-02-10  5:46 UTC (permalink / raw)
  To: Fullway Wang
  Cc: sfrench, pc, lsahlber, sprasad, linux-cifs, linux-kernel, fullwaywang

On Thu, Jan 18, 2024 at 1:44 AM Fullway Wang <fullwaywang@outlook.com> wrote:
>
> ctx->password was freed but not reset to NULL, which may lead to double
> free and secrets leak issues.

But no one else could use this pointer to double free this since it is
allocated in this function, and exits a few lines after it is freed
(and its parent is freed on the next line so the pointer could not be
accessed either)


> This is similar to CVE-2023-5345, which was fixed in commit e6e43b8.
>
> Signed-off-by: Fullway Wang <fullwaywang@outlook.com>
> ---
>  fs/smb/client/connect.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c
> index 3052a208c6ca..fb96a234b9b1 100644
> --- a/fs/smb/client/connect.c
> +++ b/fs/smb/client/connect.c
> @@ -4028,6 +4028,7 @@ cifs_construct_tcon(struct cifs_sb_info *cifs_sb, kuid_t fsuid)
>  out:
>         kfree(ctx->username);
>         kfree_sensitive(ctx->password);
> +       ctx->password = NULL;
>         kfree(ctx);
>
>         return tcon;
> --
> 2.39.3 (Apple Git-145)
>
>


-- 
Thanks,

Steve

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-02-10  5:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-18  7:43 [PATCH] fs: smb: client: Reset password pointer to NULL Fullway Wang
2024-02-10  5:46 ` Steve French

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).