From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 07642343D9D; Tue, 12 May 2026 18:11:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778609482; cv=none; b=A2HGf7+JeidQuWWfrJoYJ57T6iq8nISWTyPQzJF3vK7ItcEJGQIzfe7TQf7u2EhGHjPANzL4TVBxhKyXfIbfzHOQXT60BFJW/k37ANcLnXxA1l5UNhegocDBbI5Yd1OVqOptKn6qGwTJdXYCYxLS4tlaytYjK2j+/Xd49a63NxI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778609482; c=relaxed/simple; bh=GUb8GI8nvelFe/oDu1WI4CavHWGL48p9UnD0orbtiiw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=j+sqi5+SXnmwzsNPQKP59OOFopolCrZRF/kfAVYaG7MZVk5f47Pf2zt92QzsbFK/TVmIUpiAFNPyVsQ78eSZQp4b5sznxeKSFbeJXxhn68w37kd5ViBBgVYAiJbBEYKcRbduUhHOficOyuLtu4E8YfHzk2YB89+kjf3t3r2Gi+w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=hIODrMfw; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="hIODrMfw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5602BC2BCB0; Tue, 12 May 2026 18:11:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1778609481; bh=GUb8GI8nvelFe/oDu1WI4CavHWGL48p9UnD0orbtiiw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hIODrMfw/Mq9kLAtOUK7tMhh9WDtvySJygqrSZtIy3ICIQWNRM7BEIs/Ur7YZKtV0 nUVETppbPSzqVfpK7zXxJiwfUc3Cp/GxPyfywkxw5b7RbYs58VDqu7ZQ5hITa4qStv Ye8K7s00suK/uIhcrv7oXCyn6dg81YX28BbT8hVM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Bjoern Doebel , Steve French Subject: [PATCH 7.0 213/307] smb: client: use kzalloc to zero-initialize security descriptor buffer Date: Tue, 12 May 2026 19:40:08 +0200 Message-ID: <20260512173944.610308506@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260512173940.117428952@linuxfoundation.org> References: <20260512173940.117428952@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.0-stable review patch. If anyone has any objections, please let me know. ------------------ From: Bjoern Doebel commit 5e489c6c47a2ac15edbaca153b9348e42c1eacab upstream. Commit 62e7dd0a39c2d ("smb: common: change the data type of num_aces to le16") split struct smb_acl's __le32 num_aces field into __le16 num_aces and __le16 reserved. The reserved field corresponds to Sbz2 in the MS-DTYP ACL wire format, which must be zero [1]. When building an ACL descriptor in build_sec_desc(), we are using a kmalloc()'ed descriptor buffer and writing the fields explicitly using le16() writes now. This never writes to the 2 byte reserved field, leaving it as uninitialized heap data. When the reserved field happens to contain non-zero slab garbage, Samba rejects the security descriptor with "ndr_pull_security_descriptor failed: Range Error", causing chmod to fail with EINVAL. Change kmalloc() to kzalloc() to ensure the entire buffer is zero-initialized. Fixes: 62e7dd0a39c2d ("smb: common: change the data type of num_aces to le16") Cc: stable@vger.kernel.org Signed-off-by: Bjoern Doebel Assisted-by: Kiro:claude-opus-4.6 [1] https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-dtyp/20233ed8-a6c6-4097-aafa-dd545ed24428 Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- fs/smb/client/cifsacl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/smb/client/cifsacl.c +++ b/fs/smb/client/cifsacl.c @@ -1732,7 +1732,7 @@ id_mode_to_cifs_acl(struct inode *inode, * descriptor parameters, and security descriptor itself */ nsecdesclen = max_t(u32, nsecdesclen, DEFAULT_SEC_DESC_LEN); - pnntsd = kmalloc(nsecdesclen, GFP_KERNEL); + pnntsd = kzalloc(nsecdesclen, GFP_KERNEL); if (!pnntsd) { kfree(pntsd); cifs_put_tlink(tlink);