{"id":2223244,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2223244/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-cifs-client/patch/20260414191533.1467353-3-michael.bommarito@gmail.com/","project":{"id":12,"url":"http://patchwork.ozlabs.org/api/1.1/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":"<20260414191533.1467353-3-michael.bommarito@gmail.com>","date":"2026-04-14T19:15:32","name":"[2/3] ksmbd: reject negative ngroups in ksmbd_alloc_user()","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"925adb21e347fcfa3246bc5166c0dcd049066daf","submitter":{"id":93078,"url":"http://patchwork.ozlabs.org/api/1.1/people/93078/?format=json","name":"Michael Bommarito","email":"michael.bommarito@gmail.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-cifs-client/patch/20260414191533.1467353-3-michael.bommarito@gmail.com/mbox/","series":[{"id":499887,"url":"http://patchwork.ozlabs.org/api/1.1/series/499887/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-cifs-client/list/?series=499887","date":"2026-04-14T19:15:31","name":"ksmbd: harden IPC response arithmetic and ACE walk","version":1,"mbox":"http://patchwork.ozlabs.org/series/499887/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2223244/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2223244/checks/","tags":{},"headers":{"Return-Path":"\n <linux-cifs+bounces-10818-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 (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=FX7CsWco;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c15:e001:75::12fc:5321; helo=sin.lore.kernel.org;\n envelope-from=linux-cifs+bounces-10818-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com\n header.b=\"FX7CsWco\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=209.85.219.53","smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=gmail.com"],"Received":["from sin.lore.kernel.org (sin.lore.kernel.org\n [IPv6:2600:3c15:e001:75::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fwDX500Ztz1yHH\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 15 Apr 2026 05:16:04 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sin.lore.kernel.org (Postfix) with ESMTP id 2EDC2300D4EA\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 14 Apr 2026 19:15:43 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 703DA2D1F64;\n\tTue, 14 Apr 2026 19:15:41 +0000 (UTC)","from mail-qv1-f53.google.com (mail-qv1-f53.google.com\n [209.85.219.53])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 31567283FEF\n\tfor <linux-cifs@vger.kernel.org>; Tue, 14 Apr 2026 19:15:40 +0000 (UTC)","by mail-qv1-f53.google.com with SMTP id\n 6a1803df08f44-89f1e767f92so47882476d6.2\n        for <linux-cifs@vger.kernel.org>;\n Tue, 14 Apr 2026 12:15:40 -0700 (PDT)","from server0 (c-68-48-65-54.hsd1.mi.comcast.net. [68.48.65.54])\n        by smtp.gmail.com with ESMTPSA id\n 6a1803df08f44-8aca478a70csm77229126d6.27.2026.04.14.12.15.37\n        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n        Tue, 14 Apr 2026 12:15:38 -0700 (PDT)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1776194141; cv=none;\n b=dxA2W7ULJ/P2znVhTUTeKGGCjNca80HR83oa7PasX5mbNxVCLsrFplElbMSm0/Dd+wpUHia/IUcPr5tyQK7PSiI4FeFtitqW8mkc6rNIHNW0xHNCYPjC656gkTyMd720fS7gg0rtiEfnpXCRHQ6MoNmxVkwyynXX2LWBBiC3jgQ=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1776194141; c=relaxed/simple;\n\tbh=I7ZPd6BYpji+HeA0FutzbeEHhoDVteznmPpu9gEGUHc=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=pT8TEw6RrZrmdabxWLHpII70Q6kzwDxS1xJIR0sXR5uuR29KshLW7Bo0x3vQQRUAWOgXxOq1I3VFTGZhqy3ONepLbNoHBXTeYWLX5gNSiUxVFI/p5ios+ktrolO3Z6SiCZmuZdHsd/xcbPbN8PojmrsfdLCK8L8LOlH8+fW++1A=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com;\n spf=pass smtp.mailfrom=gmail.com;\n dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com\n header.b=FX7CsWco; arc=none smtp.client-ip=209.85.219.53","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=gmail.com; s=20251104; t=1776194139; x=1776798939;\n darn=vger.kernel.org;\n        h=content-transfer-encoding:mime-version:references:in-reply-to\n         :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n         :message-id:reply-to;\n        bh=koYFiagrEfQMs7bgNuUQ21Zxibgpf6kYEiIIemViCQ8=;\n        b=FX7CsWcoYyxjgsun6VL7si4tj/S0zOFXJyksWA662F2hblqvLBemKSOlOyCrOVpDs2\n         b79AWQ9PKXnHoXSH0wrvoJBFfH+ZMUa3KSYDSQ+6yI0YmTHyHhBwT3tVyaTUy8DYp4qC\n         cv1Unpn+sVaDXZHgeddXHKv4RClt12GVRJAZRoELhMZogWrWTItY3gUGYH1gEV1SzPUV\n         W+UL+O2950oHh6wn+KaUMQH4a0TsDmFavoVSq8nY0vQvqUMFQ4L/WzFqPTlazNx1FKMD\n         ruCAukqxIfAfbL+a3aL92+qLBKpKuUC0nSenPC/nGYKmQjhqqZ9so0Ds6jGJuQUIM9aE\n         EvnA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=1e100.net; s=20251104; t=1776194139; x=1776798939;\n        h=content-transfer-encoding:mime-version:references:in-reply-to\n         :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n         :to:cc:subject:date:message-id:reply-to;\n        bh=koYFiagrEfQMs7bgNuUQ21Zxibgpf6kYEiIIemViCQ8=;\n        b=NuBq/C3fwoiFRrVP9LMSgAaBf1ppJXtXzE/h7+JCKwTE27LjQZxiRTlyHmop0gLBet\n         WnXbq+g5EY3zZR/xuNrlgBjp75kjBWCuAUsR8hbsfX4vVRv97nzbIcIzmjBpuJiuxNxY\n         grPNHxnRh8Jy6+BDnd+6000OMlkpAMe2FippgPEASWYgOUa8etR7vL7TiY0kSBWvZZyC\n         uTwGfYQuzh5XrZ1/URyz9IBg1RZ+e36iXucAdi/1UsrHbDNfbUzz+XPf24wpJMq6uCal\n         foGx/66/0MX1au7sr3ojpy1oyAXQ61nvATOBX11KLwin8wHgJ3SAwpwC7H8zWPdarRHS\n         KAHw==","X-Gm-Message-State":"AOJu0Yw6Itii/2Z289xS7Ln+2gmF2AJKk3HXbI6k0wZBMCnVS7kj1ezt\n\tTxWFIk2EEI5RYSgwmxWE8FD2pEquITO9SKJ23VxM3Tu/Cp4+nw/VulvwaUUjT9pm","X-Gm-Gg":"AeBDieuzwq6zKt426tD3Dnz1EdKxDERbRGgJnL8iEGZiOnKoEm43JOQBNf6kCej2dmm\n\t41af456a6mkqPlnCVGTjoJ2OZik10rFwk98N49dbVpzAp9FMy9mCqTke33vcKdAQWk/0kPNqjUc\n\tyGP07U+S6BA4aNmJS/maHQlWwNu8a7rjldEZhkzxp90q1y0xh7xTRrr0K9H3GL1ipSFI1LAKVgP\n\tGw2SdGEiBp3Syz8ERK6tORMlF8Qq2FUaG3P+Zkk1Sq2j9BjlUOrHuwpNoa26GnTB8MLWpkGAgDP\n\tYqd/E5q/49Iu8F79kpF7BaQ4jqiLCYGVsWmCWcrtRfSVvHVqnN74jZbzeou8EhsfsA9qizz2t4x\n\tt3USGBZGGe2qnQLT79HoTiOzt3YGw807EeiDbxYjQPJjqI5whHGs0Sgzcbl+MJftAH36JVaTLoJ\n\t8o0bJGUOAQwDrPy2UsXxayC2AvE9/WanEYJ2y7C4cBuMgzY8dvnawzGaq/Q1L8J4/0/W5vYplPA\n\t38HeUTq0VghVpIBWKXWmzeT5Yr4bGg=","X-Received":"by 2002:ad4:5d47:0:b0:8ae:64c0:c922 with SMTP id\n 6a1803df08f44-8ae64c0ccd2mr36692696d6.46.1776194138726;\n        Tue, 14 Apr 2026 12:15:38 -0700 (PDT)","From":"Michael Bommarito <michael.bommarito@gmail.com>","To":"linux-cifs@vger.kernel.org,\n\tNamjae Jeon <linkinjeon@kernel.org>,\n\tSteve French <smfrench@gmail.com>","Cc":"Sergey Senozhatsky <senozhatsky@chromium.org>,\n\tTom Talpey <tom@talpey.com>,\n\tstable@vger.kernel.org","Subject":"[PATCH 2/3] ksmbd: reject negative ngroups in ksmbd_alloc_user()","Date":"Tue, 14 Apr 2026 15:15:32 -0400","Message-ID":"<20260414191533.1467353-3-michael.bommarito@gmail.com>","X-Mailer":"git-send-email 2.53.0","In-Reply-To":"<20260414191533.1467353-1-michael.bommarito@gmail.com>","References":"<20260414191533.1467353-1-michael.bommarito@gmail.com>","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","Content-Transfer-Encoding":"8bit"},"content":"resp_ext->ngroups is __s32.  ksmbd_alloc_user() guards against\noversized group counts with\n\n\tif (resp_ext->ngroups > NGROUPS_MAX)\n\t\tgoto err_free;\n\nbut the signed comparison does not catch negative values.  A\nnegative ngroups passes through into the subsequent multiplication\n\n\tresp_ext->ngroups * sizeof(gid_t)\n\nwhere signed-to-size_t conversion turns e.g. -1 into SIZE_MAX, and\nkmemdup() is handed an absurd size.  In practice kmemdup() fails\ngracefully on the huge allocation, but the intent of the guard is\nto reject out-of-range values up front, not rely on the allocator\nto notice.\n\nReject negative ngroups explicitly so the check reflects the actual\nvalid range, and switch the log format for ngroups from %u to %d so\nthe bad signed value is printed correctly.\n\nFixes: a77e0e02af1c (\"ksmbd: add support for supplementary groups\")\nCc: stable@vger.kernel.org\nAssisted-by: Claude:claude-opus-4-6\nAssisted-by: Codex:gpt-5-4\nSigned-off-by: Michael Bommarito <michael.bommarito@gmail.com>\n---\n\nfs/smb/server/mgmt/user_config.c | 4 ++--\n1 file changed, 2 insertions(+), 2 deletions(-)\n\n--\n2.53.0","diff":"diff --git a/fs/smb/server/mgmt/user_config.c b/fs/smb/server/mgmt/user_config.c\nindex a3183fe5c536..c62e2bf0ebef 100644\n--- a/fs/smb/server/mgmt/user_config.c\n+++ b/fs/smb/server/mgmt/user_config.c\n@@ -56,8 +56,8 @@ struct ksmbd_user *ksmbd_alloc_user(struct ksmbd_login_response *resp,\n \t\tgoto err_free;\n \n \tif (resp_ext) {\n-\t\tif (resp_ext->ngroups > NGROUPS_MAX) {\n-\t\t\tpr_err(\"ngroups(%u) from login response exceeds max groups(%d)\\n\",\n+\t\tif (resp_ext->ngroups < 0 || resp_ext->ngroups > NGROUPS_MAX) {\n+\t\t\tpr_err(\"ngroups(%d) from login response exceeds max groups(%d)\\n\",\n \t\t\t\t\tresp_ext->ngroups, NGROUPS_MAX);\n \t\t\tgoto err_free;\n \t\t}\n","prefixes":["2/3"]}