From: Thomas Huth <thuth@redhat.com>
To: Namjae Jeon <linkinjeon@kernel.org>, Steve French <smfrench@gmail.com>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>,
Tom Talpey <tom@talpey.com>,
linux-cifs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 3/4] smb: server: Free session data with kfree_sensitive() to avoid leaking of data
Date: Mon, 10 Aug 2026 14:58:56 +0200 [thread overview]
Message-ID: <20260810125857.1009618-4-thuth@redhat.com> (raw)
In-Reply-To: <20260810125857.1009618-1-thuth@redhat.com>
From: Thomas Huth <thuth@redhat.com>
struct ksmbd_session contains some arrays with sensitive information, like
sess_key, smb3encryptionkey, smb3decryptionkey and smb3signingkey. Thus
let's make sure that this information cannot leak via the heap and use
kfree_sensitive() to free it.
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
fs/smb/server/mgmt/user_session.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/smb/server/mgmt/user_session.c b/fs/smb/server/mgmt/user_session.c
index f99c86284ba3d..9cb990a22fd56 100644
--- a/fs/smb/server/mgmt/user_session.c
+++ b/fs/smb/server/mgmt/user_session.c
@@ -389,10 +389,10 @@ void ksmbd_session_destroy(struct ksmbd_session *sess)
ksmbd_launch_ksmbd_durable_scavenger();
ksmbd_session_rpc_clear_list(sess);
free_channel_list(sess);
- kfree(sess->Preauth_HashValue);
+ kfree_sensitive(sess->Preauth_HashValue);
ksmbd_release_id(&session_ida, sess->id);
ida_destroy(&sess->tree_conn_ida);
- kfree(sess);
+ kfree_sensitive(sess);
}
struct ksmbd_session *__session_lookup(unsigned long long id)
--
2.55.0
next prev parent reply other threads:[~2026-08-10 12:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-10 12:58 [PATCH 0/4] smb: server: Clear sensitive data before freeing it Thomas Huth
2026-08-10 12:58 ` [PATCH 1/4] smb: server: Clear sensitive stack and heap data in auth.c Thomas Huth
2026-08-11 10:17 ` Namjae Jeon
2026-08-10 12:58 ` [PATCH 2/4] smb: server: Make sure that passkey is not leaked on the heap in user_config.c Thomas Huth
2026-08-10 12:58 ` Thomas Huth [this message]
2026-08-11 10:20 ` [PATCH 3/4] smb: server: Free session data with kfree_sensitive() to avoid leaking of data Namjae Jeon
2026-08-10 12:58 ` [PATCH 4/4] smb: server: Free sensitive connection data with kfree_sensitive() Thomas Huth
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=20260810125857.1009618-4-thuth@redhat.com \
--to=thuth@redhat.com \
--cc=linkinjeon@kernel.org \
--cc=linux-cifs@vger.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 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.