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 5BB8543B3FF for ; Wed, 12 Aug 2026 13:02:11 +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=1786539732; cv=none; b=s9pyyw7LI3mvn5SlrRtd8Xg8cG3u6D8FsWzzP/DrGqewYZm21wKW5l1D1fD8AbMFjo85IeAwJ3oxZnJc82XO0/3Tl3iE7t22rJSLRUcZnfrntpgivHiBNX1dX45dLj7SK1jEMa/lE8N3zmle3T2FXx0Y5lObF7uQTi7vnKaIwHE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786539732; c=relaxed/simple; bh=ybWsysO1/ldrbMjwy4Ja+LI1+6iB7pNifJt1mUe1yP4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dy4Yo1eo5bQj3v62727Kbenr88xt964T79e7Tm2GIAGehDZHs8TON5l9iV6gVQg/1J2/HD+O2mrVyn2//jhDkUNoU7XWS949+qVqoloAyJuFCyAl0gKPGJ0VfduKm6xL6m4B1s58biwzlTnRd3KY0f33TsnCM/2ewBXreOW2UuY= 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=d54h4oz3; 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="d54h4oz3" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786539730; 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=8a8VGNlPQgljRTJ9YZVx795VkCB4+m1vlXsh/HAygJo=; b=d54h4oz35Xh9eONNBgB2fYNmXOriQRrUtyYYbmujB/NiPQeOvm/E+ex/6qL8ocjHGHXv7h /ti6LdGJPRo2+IxqsNu42bIF2dWyphj3pCDimpA4B5w7gxBHrKgcJo73lV8j3GEsm9AbvG p7qDk5hMHA4Clj6/J8YPIfqv5880e4M= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-613-jxb2MRUTMwmOViYxJd9RNA-1; Wed, 12 Aug 2026 09:02:04 -0400 X-MC-Unique: jxb2MRUTMwmOViYxJd9RNA-1 X-Mimecast-MFC-AGG-ID: jxb2MRUTMwmOViYxJd9RNA_1786539723 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 66B981954B07; Wed, 12 Aug 2026 13:02:03 +0000 (UTC) Received: from thuth-p1g4.redhat.corp (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 1E221195DF9A; Wed, 12 Aug 2026 13:02:00 +0000 (UTC) From: Thomas Huth To: Steve French Cc: Paulo Alcantara , Ronnie Sahlberg , Shyam Prasad N , Tom Talpey , Bharath SM , linux-cifs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/5] smb: client: Clear sensitive stack and heap data in smb2ops.c Date: Wed, 12 Aug 2026 15:01:49 +0200 Message-ID: <20260812130152.2861834-3-thuth@redhat.com> In-Reply-To: <20260812130152.2861834-1-thuth@redhat.com> References: <20260812130152.2861834-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.0 on 10.30.177.12 From: Thomas Huth Make sure to not leak key-related data via the heap or the stack by using kfree_sensitive() or memzero_explicit() here. Signed-off-by: Thomas Huth --- fs/smb/client/smb2ops.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/smb/client/smb2ops.c b/fs/smb/client/smb2ops.c index 192649fec25d5..a3099a0e5c2be 100644 --- a/fs/smb/client/smb2ops.c +++ b/fs/smb/client/smb2ops.c @@ -1569,7 +1569,7 @@ SMB2_request_res_key(const unsigned int xid, struct cifs_tcon *tcon, memcpy(pcchunk->SourceKey, res_key->ResumeKey, COPY_CHUNK_RES_KEY_SIZE); req_res_key_exit: - kfree(res_key); + kfree_sensitive(res_key); return rc; } @@ -4636,7 +4636,7 @@ crypt_message(struct TCP_Server_Info *server, int num_rqst, rc = crypto_aead_setkey(tfm, key, SMB3_GCM256_CRYPTKEY_SIZE); else rc = crypto_aead_setkey(tfm, key, SMB3_GCM128_CRYPTKEY_SIZE); - + memzero_explicit(key, sizeof(key)); if (rc) { cifs_server_dbg(VFS, "%s: Failed to set aead key %d\n", __func__, rc); return rc; -- 2.55.0