From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CD0663C061C for ; Tue, 11 Aug 2026 15:46:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786463201; cv=none; b=qlDduolhyUXb/jgEMRCfZaf1DVl4YQBEt9BW2WXhhhiE0vIbJBoVJKkRRIo+W79rNS1fRu+OldbyYFvIymyzfRdpW3Zl3UD7Vmg8vXMrFby+/UjcUMv5gey6VMOs71s8HhNZOFVVsWz1sKch81axGKvU9v7Il+WiSbz/Sx3hem0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786463201; c=relaxed/simple; bh=bqx3BjBbvTbeuGV0qkFsGaKkfysKhy/kb4On0buQoio=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AmbRgX4y9+oiHmblTy15MaSjUoEVBjmLSfZjH/yMedx4mOp7wY6j59ULtXM98SD5YZbu5sziY6pPiXPFcO+3zeMxUbXkt7c9146jCeCe8mDWHUZ9Y75W9dCp1e/Ezi4EOKJtJjNeio6y7iYocKP4R0scj1gT8e5FCE5N6Irky5g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=LGbbIE6q; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="LGbbIE6q" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786463198; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xk7zF9B337l+v+zmWz075wTvLr5aI1bS+oxgsAu+NpU=; b=LGbbIE6qJiATS+O+R5HmjDNJENd/hN4XETK39ClK6TPxL8fTbtAYehU+bLowCucA8nkpIg QrRCFI3hlozq/yIayaIg/koOocQnUNLmijFYSOArV4nAEp4UyKr7CF1hiSd6vhj5Uu/6Dp GDty38VHZyM+IjMv5FL33R7JxO4QwEE= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-695-AGZOc3tTOqWniLxpJGDXEA-1; Tue, 11 Aug 2026 11:46:33 -0400 X-MC-Unique: AGZOc3tTOqWniLxpJGDXEA-1 X-Mimecast-MFC-AGG-ID: AGZOc3tTOqWniLxpJGDXEA_1786463192 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1F23F180064C; Tue, 11 Aug 2026 15:46:32 +0000 (UTC) Received: from thuth-p1g4.redhat.corp (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D476E3001DAF; Tue, 11 Aug 2026 15:46:29 +0000 (UTC) From: Thomas Huth To: Namjae Jeon , Steve French Cc: linux-kernel@vger.kernel.org, Sergey Senozhatsky , Tom Talpey Subject: [PATCH v2 3/5] smb: server: Free session data in user_session.c with kfree_sensitive() Date: Tue, 11 Aug 2026 17:46:18 +0200 Message-ID: <20260811154620.2425851-4-thuth@redhat.com> In-Reply-To: <20260811154620.2425851-1-thuth@redhat.com> References: <20260811154620.2425851-1-thuth@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 From: Thomas Huth 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 --- 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