{"id":2220131,"url":"http://patchwork.ozlabs.org/api/1.0/patches/2220131/?format=json","project":{"id":12,"url":"http://patchwork.ozlabs.org/api/1.0/projects/12/?format=json","name":"Linux CIFS Client","link_name":"linux-cifs-client","list_id":"linux-cifs.vger.kernel.org","list_email":"linux-cifs@vger.kernel.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<2026040646-helium-unedited-245a@gregkh>","date":"2026-04-06T13:46:47","name":"[2/3] ksmbd: require 3 sub-authorities before reading sub_auth[2]","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"17c97fa7dca4769d79d4ec69a7d9965914d39a2d","submitter":{"id":11800,"url":"http://patchwork.ozlabs.org/api/1.0/people/11800/?format=json","name":"Greg Kroah-Hartman","email":"gregkh@linuxfoundation.org"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-cifs-client/patch/2026040646-helium-unedited-245a@gregkh/mbox/","series":[{"id":498855,"url":"http://patchwork.ozlabs.org/api/1.0/series/498855/?format=json","date":"2026-04-06T13:46:46","name":"ksmbd: some potential bugfixes","version":1,"mbox":"http://patchwork.ozlabs.org/series/498855/mbox/"}],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2220131/checks/","tags":{},"headers":{"Return-Path":"\n <linux-cifs+bounces-10677-incoming=patchwork.ozlabs.org@vger.kernel.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-cifs@vger.kernel.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=linuxfoundation.org header.i=@linuxfoundation.org\n header.a=rsa-sha256 header.s=korg header.b=19JfWLx9;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=linux-cifs+bounces-10677-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (1024-bit key) header.d=linuxfoundation.org\n header.i=@linuxfoundation.org header.b=\"19JfWLx9\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=10.30.226.201"],"Received":["from sea.lore.kernel.org (sea.lore.kernel.org\n [IPv6:2600:3c0a:e001:db::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fq9d16kK7z1xy1\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 06 Apr 2026 23:47:49 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id CD929302352B\n\tfor <incoming@patchwork.ozlabs.org>; Mon,  6 Apr 2026 13:47:06 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 335BD22D792;\n\tMon,  6 Apr 2026 13:47:06 +0000 (UTC)","from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org\n [10.30.226.201])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 110F0224B15;\n\tMon,  6 Apr 2026 13:47:05 +0000 (UTC)","by smtp.kernel.org (Postfix) with ESMTPSA id 43857C4CEF7;\n\tMon,  6 Apr 2026 13:47:05 +0000 (UTC)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1775483226; cv=none;\n b=JIS3CDo93lQmRBnaQzC1xYcTiHH1eD+iBX809cL4BsIlTAp5/pgTZuLsds2oWCblwA6Rf/8gqfr3AospiLLwChM1NI2LNi4DWX+9gybrs34NY44gw2SGc3pZ8urMODZKhIchzqFM/PN9AdjFjCr43iRkjVAaYbjq2Z6V8ZxDegs=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1775483226; c=relaxed/simple;\n\tbh=6quP6INyONpIyrEnc1WgDudBTHdciV3E8oow+ilwgE8=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=l8n3Ma5SYJOhnJPXDa3C31Ou+qkDZZ7dRhkN8RyC1AFdDrUW3EHE3QLHDLY8TG4PIIs0Myow/woZAgjNITFrKRb2heTlw6x4xZWCf6JMneVFOqchSjShm4Wch1qQIzhXorwlY7kyM9kfJgq0DYOdyk1xXcz4alQzN7wouM93rIg=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dkim=pass (1024-bit key) header.d=linuxfoundation.org\n header.i=@linuxfoundation.org header.b=19JfWLx9;\n arc=none smtp.client-ip=10.30.226.201","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org;\n\ts=korg; t=1775483225;\n\tbh=6quP6INyONpIyrEnc1WgDudBTHdciV3E8oow+ilwgE8=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=19JfWLx9V+n/p9bBkif3m0PzGMSyBIVyCDeEkkdaLTE9yg5N/IS7qFHcTf4eOjkp/\n\t GjBgD8BDEFDF7K1QscjILfNxYJuWfm/6NJgj10N2tFNNYZXYpmoZmAuPgRPvdwqDJ7\n\t sx636ATNio6YGWtJRZm81SMfD09RahbK0qUqlsvg=","From":"Greg Kroah-Hartman <gregkh@linuxfoundation.org>","To":"linux-cifs@vger.kernel.org","Cc":"linux-kernel@vger.kernel.org,\n\tGreg Kroah-Hartman <gregkh@linuxfoundation.org>,\n\tNamjae Jeon <linkinjeon@kernel.org>,\n\tSteve French <smfrench@gmail.com>,\n\tSergey Senozhatsky <senozhatsky@chromium.org>,\n\tTom Talpey <tom@talpey.com>,\n\tstable <stable@kernel.org>","Subject":"[PATCH 2/3] ksmbd: require 3 sub-authorities before reading\n sub_auth[2]","Date":"Mon,  6 Apr 2026 15:46:47 +0200","Message-ID":"<2026040646-helium-unedited-245a@gregkh>","X-Mailer":"git-send-email 2.53.0","In-Reply-To":"<2026040644-brussels-dab-6f99@gregkh>","References":"<2026040644-brussels-dab-6f99@gregkh>","Precedence":"bulk","X-Mailing-List":"linux-cifs@vger.kernel.org","List-Id":"<linux-cifs.vger.kernel.org>","List-Subscribe":"<mailto:linux-cifs+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-cifs+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","Lines":"43","X-Developer-Signature":"v=1; a=openpgp-sha256; l=1719;\n i=gregkh@linuxfoundation.org; h=from:subject:message-id;\n bh=6quP6INyONpIyrEnc1WgDudBTHdciV3E8oow+ilwgE8=;\n b=owGbwMvMwCRo6H6F97bub03G02pJDJmXd7o1Sp17sDHlVOAuRY2HBxZd+LbpzZsfT1IUmPp+T\n 3k+pXNGdUcsC4MgE4OsmCLLl208R/dXHFL0MrQ9DTOHlQlkCAMXpwBM5NpdhgVn/6WGmbd8nBfj\n u/zZhJzmk89fTsxgmCupWbHT0W4Xo+qi50svnt2xy2Xu11wA","X-Developer-Key":"i=gregkh@linuxfoundation.org; a=openpgp;\n fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29","Content-Transfer-Encoding":"8bit"},"content":"parse_dacl() compares each ACE SID against sid_unix_NFS_mode and on\nmatch reads sid.sub_auth[2] as the file mode.  If sid_unix_NFS_mode is\nthe prefix S-1-5-88-3 with num_subauth = 2 then compare_sids() compares\nonly min(num_subauth, 2) sub-authorities so a client SID with\nnum_subauth = 2 and sub_auth = {88, 3} will match.\n\nIf num_subauth = 2 and the ACE is placed at the very end of the security\ndescriptor, sub_auth[2] will be  4 bytes past end_of_acl.  The\nout-of-band bytes will then be masked to the low 9 bits and applied as\nthe file's POSIX mode, probably not something that is good to have\nhappen.\n\nFix this up by forcing the SID to actually carry a third sub-authority\nbefore reading it at all.\n\nCc: Namjae Jeon <linkinjeon@kernel.org>\nCc: Steve French <smfrench@gmail.com>\nCc: Sergey Senozhatsky <senozhatsky@chromium.org>\nCc: Tom Talpey <tom@talpey.com>\nCc: linux-cifs@vger.kernel.org\nCc: stable <stable@kernel.org>\nAssisted-by: gregkh_clanker_t1000\nSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>\n---\n fs/smb/server/smbacl.c | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)","diff":"diff --git a/fs/smb/server/smbacl.c b/fs/smb/server/smbacl.c\nindex c30d01877c41..061a305bf9c8 100644\n--- a/fs/smb/server/smbacl.c\n+++ b/fs/smb/server/smbacl.c\n@@ -451,7 +451,8 @@ static void parse_dacl(struct mnt_idmap *idmap,\n \t\tppace[i]->access_req =\n \t\t\tsmb_map_generic_desired_access(ppace[i]->access_req);\n \n-\t\tif (!(compare_sids(&ppace[i]->sid, &sid_unix_NFS_mode))) {\n+\t\tif (ppace[i]->sid.num_subauth >= 3 &&\n+\t\t    !(compare_sids(&ppace[i]->sid, &sid_unix_NFS_mode))) {\n \t\t\tfattr->cf_mode =\n \t\t\t\tle32_to_cpu(ppace[i]->sid.sub_auth[2]);\n \t\t\tbreak;\n","prefixes":["2/3"]}