mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: Namjae Jeon <linkinjeon@kernel.org>, Steve French <smfrench@gmail.com>
Cc: linux-kernel@vger.kernel.org,
	Sergey Senozhatsky <senozhatsky@chromium.org>,
	Tom Talpey <tom@talpey.com>
Subject: [PATCH v2 5/5] smb: server: Clear Preauth_HashValue in smb2pdu.c with kfree_sensitive()
Date: Tue, 11 Aug 2026 17:46:20 +0200	[thread overview]
Message-ID: <20260811154620.2425851-6-thuth@redhat.com> (raw)
In-Reply-To: <20260811154620.2425851-1-thuth@redhat.com>

From: Thomas Huth <thuth@redhat.com>

struct preauth_session contains the Preauth_HashValue[] array that
might contain sensitive data. Use kfree_sensitive() to clear it
before returning the memory to the heap.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 fs/smb/server/smb2pdu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c
index 184501e08b29a..fc44ac6b56427 100644
--- a/fs/smb/server/smb2pdu.c
+++ b/fs/smb/server/smb2pdu.c
@@ -2136,7 +2136,7 @@ int smb2_sess_setup(struct ksmbd_work *work)
 						ksmbd_preauth_session_lookup(conn, sess->id);
 					if (preauth_sess) {
 						list_del(&preauth_sess->preauth_entry);
-						kfree(preauth_sess);
+						kfree_sensitive(preauth_sess);
 					}
 				}
 			} else {
@@ -2190,7 +2190,7 @@ int smb2_sess_setup(struct ksmbd_work *work)
 			preauth_sess = ksmbd_preauth_session_lookup(conn, sess->id);
 			if (preauth_sess) {
 				list_del(&preauth_sess->preauth_entry);
-				kfree(preauth_sess);
+				kfree_sensitive(preauth_sess);
 			}
 		}
 
-- 
2.55.0


  parent reply	other threads:[~2026-08-11 15:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-11 15:46 [PATCH v2 0/5] smb: server: Clear sensitive data before freeing it Thomas Huth
2026-08-11 15:46 ` [PATCH v2 1/5] smb: server: Clear sensitive stack and heap data in auth.c Thomas Huth
2026-08-11 15:46 ` [PATCH v2 2/5] smb: server: Make sure that passkey is not leaked on the heap in user_config.c Thomas Huth
2026-08-11 15:46 ` [PATCH v2 3/5] smb: server: Free session data in user_session.c with kfree_sensitive() Thomas Huth
2026-08-11 15:46 ` [PATCH v2 4/5] smb: server: Free sensitive data in connection.c " Thomas Huth
2026-08-11 15:46 ` Thomas Huth [this message]
2026-08-12 12:41 ` [PATCH v2 0/5] smb: server: Clear sensitive data before freeing it Namjae Jeon

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=20260811154620.2425851-6-thuth@redhat.com \
    --to=thuth@redhat.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=senozhatsky@chromium.org \
    --cc=smfrench@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®