{"id":2229276,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2229276/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-cifs-client/patch/20260428025110.38825-1-FredTheDude@proton.me/","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":"<20260428025110.38825-1-FredTheDude@proton.me>","date":"2026-04-28T02:51:10","name":"[RFC] smb: client: fix NULL pointer dereference in smb2_compound_op","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"2b5af3b3cee265c3c9d0ad3b9ed9f5d4c0cc035a","submitter":{"id":93268,"url":"http://patchwork.ozlabs.org/api/1.1/people/93268/?format=json","name":"Fredric Cover","email":"fredric.cover.lkernel@gmail.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-cifs-client/patch/20260428025110.38825-1-FredTheDude@proton.me/mbox/","series":[{"id":501751,"url":"http://patchwork.ozlabs.org/api/1.1/series/501751/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-cifs-client/list/?series=501751","date":"2026-04-28T02:51:10","name":"[RFC] smb: client: fix NULL pointer dereference in smb2_compound_op","version":1,"mbox":"http://patchwork.ozlabs.org/series/501751/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2229276/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2229276/checks/","tags":{},"headers":{"Return-Path":"\n <linux-cifs+bounces-11181-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=tIHGAWKO;\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-11181-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=\"tIHGAWKO\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=74.125.82.51","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 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 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g4Q2c6lqmz1yHv\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 28 Apr 2026 12:52:24 +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 BFB71301D311\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 28 Apr 2026 02:52:21 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 5AB2D28C854;\n\tTue, 28 Apr 2026 02:52:20 +0000 (UTC)","from mail-dl1-f51.google.com (mail-dl1-f51.google.com\n [74.125.82.51])\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 17DBD175A86\n\tfor <linux-cifs@vger.kernel.org>; Tue, 28 Apr 2026 02:52:18 +0000 (UTC)","by mail-dl1-f51.google.com with SMTP id\n a92af1059eb24-12ddbe104ccso1090906c88.0\n        for <linux-cifs@vger.kernel.org>;\n Mon, 27 Apr 2026 19:52:18 -0700 (PDT)","from FredPC.wirelessinternet (mobile-166-176-187-202.mycingular.net.\n [166.176.187.202])\n        by smtp.gmail.com with ESMTPSA id\n a92af1059eb24-12ddd9a63a7sm1210664c88.11.2026.04.27.19.52.16\n        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n        Mon, 27 Apr 2026 19:52:17 -0700 (PDT)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1777344740; cv=none;\n b=NEHvfhJugPWZoUCdKIiRSjlpG1ZHe6dNrJAJyO5aecb6oI/wrFfaVWGlofCe5EW5lEv3/KD6RF4ItsaA2i3uFyikKdwytB44SBZ3bL5gvVgq3hE4jiYQTva30GycTXuTzaTeZ+FKJHw4KRNk4Dz6OB74Wns29vT/mutoTDPbaaU=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1777344740; c=relaxed/simple;\n\tbh=TkoPdIVnEDDcQkPQIK1u6AA2DgP5kx9+S9MtA08CmZY=;\n\th=From:To:Cc:Subject:Date:Message-ID:MIME-Version;\n b=NFEeqgsCI1zoEYli3YenX/upoLHm8xUZHwGjbRXRrh5cxbUruGXKGDUTZrM6ZXA5AOCjIQ4Cp3Lp8GswEesHm4JpP5OKzpDZHAHJ+ac/gXreI7/UJU64Jfyd7r+vzBY2kcKuNlORp3aBMZqPgyZ3Bvfni03P26S3ptWAruv9D94=","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=tIHGAWKO; arc=none smtp.client-ip=74.125.82.51","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=gmail.com; s=20251104; t=1777344738; x=1777949538;\n darn=vger.kernel.org;\n        h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n         :to:from:from:to:cc:subject:date:message-id:reply-to;\n        bh=a8Nhk45wzO3zlFt88EGGS6yZ3Zatdszo/GvXIEznylg=;\n        b=tIHGAWKO69bmUBlcVuZ9ibWlVt9fv12KA46fvx0WfMitONXTEBr5dK4ioRvTQwURoS\n         bdwqgGD4lrT6Ct8VPgvFp8qOJd3OBVk9P51LV2iZpaufh4v5zsl5VdhAGc/pJLHEtj7J\n         f1qkEwVLNtUo7+UaoZC0y5bTQp8mCRjpFkigR0JKCPBSGI2EbvRY/myGstH68oqm+Ub5\n         nYD7SWv0RLpeM5kPc6Rivie8ayRSO+DDgTskQVYZRSYK0A7urXOT0UIiU9J8zfljrK91\n         qDnAerWk0EckTjFRXPB0GfXLONzYL/3W2hJ0EHTu0v33meZg4rvpto1enmT6bXuTPU5Z\n         6ihA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=1e100.net; s=20251104; t=1777344738; x=1777949538;\n        h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n         :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date\n         :message-id:reply-to;\n        bh=a8Nhk45wzO3zlFt88EGGS6yZ3Zatdszo/GvXIEznylg=;\n        b=UADFZX+paQINGdcq700cN/6hFXQZ04WVzvKW8KwLpGrd0jn43/5/VOrmlwjSXqDljr\n         rS/jnQJepeDYgmTbvtdmUwWsD5PaWXCZ1h/4bWhzk92EoQQGFSJFqYGrc1lcJYixzRe/\n         NFgEva+9paTu2fZYgBsxvKohnSD1N/XHB//HFNHmVFh8/9WnhxIEfV6FUezuskNQEuz2\n         UXEgENFc4BfKfqBOuZt5g0lder+zVT+H+37AIoJGjwQAe8kZ2nSoL9WmcwBMqRm325xk\n         pq7bPMQClktd0lPkKj4S4hY1R1Qq1fWBc5bqBSgrSXWk/Y7XIXc+DJMUFc3BdqsK74QL\n         Rumg==","X-Gm-Message-State":"AOJu0YzRwjswBdEqA0M4frKToEoTeLwXmj7Lo4zNB+YiMgYp/wIcHowM\n\tsi30fw9doCo1rkAPHDClQvA1tiq6gqQxXlnnYHCpIixloNbRiebZ3O7p","X-Gm-Gg":"AeBDies48CwFqZkg/W0oFVhrzRU+6PB+ODxhAXS8zgErNS+Tpx7oWnpwQXTXFTzSkHO\n\tD2q0iibAH23MBkW38lxFv0xxz7fz6CoI1dPLxbyckK+Yoyf9wL2Jp0+9t0hXo53oELthv2qc6oT\n\tLFlYUZjeyookqj7Fp/hqYEdb2c1N3fQZrh5ct0VatgiD7J4y53O0cQeOwoHNDCtEUxfOe/ufwik\n\t5UFgcz7FWZJRz+WC2/c81JLTVNWz4vuK7Me4yt9/9L8OJAAC17Uv7gYDEEzkNYchahnfXSCXIoX\n\tXUz14ED4xidEenIx8D42gMbRGhHUCj5XlolapwBudUTrBljiT0HIgwztvVFNdLvJI71XMZoYksC\n\t9JmY/wQt5MgL7aQYgooaYoWfTTPIqD8vH1mD6AedRJS5poy9864G5/RfbVBi/rATUIKMDfdPyV6\n\tTTpXnFsO4Z6GJLOQ3aaxohlWqm+A2tnoFNrAZxss2R+RR6m1A9/hVKKHWhrbHUqnXKez6v/4xD3\n\tNzF46VFjEWAR1HBw5eHzg==","X-Received":"by 2002:a05:7022:eacd:b0:12c:2cf8:2f30 with SMTP id\n a92af1059eb24-12ddd9614a5mr665176c88.15.1777344738072;\n        Mon, 27 Apr 2026 19:52:18 -0700 (PDT)","From":"Fredric Cover <fredric.cover.lkernel@gmail.com>","X-Google-Original-From":"Fredric Cover <FredTheDude@proton.me>","To":"Steve French <sfrench@samba.org>,\n\tPaulo Alcantara <pc@manguebit.com>","Cc":"linux-cifs@vger.kernel.org,\n\tlinux-kernel@vger.kernel.org,\n\tFredric Cover <fredric.cover.lkernel@gmail.com>","Subject":"[PATCH RFC] smb: client: fix NULL pointer dereference in\n smb2_compound_op","Date":"Mon, 27 Apr 2026 19:51:10 -0700","Message-ID":"<20260428025110.38825-1-FredTheDude@proton.me>","X-Mailer":"git-send-email 2.43.0","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":"From: Fredric Cover <fredric.cover.lkernel@gmail.com>\n\nWhen a valid cfile is passed to smb2_compound_op, the code uses a\ngoto to jump to the 'after_open' label. This bypasses the\ninitialization of rqst[0] by SMB2_open_init().\n\nHowever, the 'finished' cleanup block unconditionally attempts to\ncall SMB2_open_free() on rqst[0]. If SMB2_open_init() was skipped,\nrqst[0].rq_iov is NULL, leading to a NULL pointer dereference.\n\nCheck for a valid rq_iov before attempting to free the request\nto prevent the crash in handle-reuse scenarios.\n\nSigned-off-by: Fredric Cover <fredric.cover.lkernel@gmail.com>\n---\nI am new to writing code for the Linux kernel.\nPlease be patient with me and feel free to point out any\nobvious mistakes I made. \nI tested this patch in a user-space skeleton clone using ASan.\nI only have access to a shallow clone and cannot find the \noriginal commit for the 'Fixes:' line.\n---\n fs/smb/client/smb2inode.c | 8 +++++++-\n 1 file changed, 7 insertions(+), 1 deletion(-)","diff":"diff --git a/fs/smb/client/smb2inode.c b/fs/smb/client/smb2inode.c\nindex c6dd282fc..aed96eeba 100644\n--- a/fs/smb/client/smb2inode.c\n+++ b/fs/smb/client/smb2inode.c\n@@ -552,7 +552,13 @@ static int smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,\n \n finished:\n \tnum_rqst = 0;\n-\tSMB2_open_free(&rqst[num_rqst++]);\n+\t/*\n+\t * If cfile was passed, the open was skipped; check rq_iov\n+\t * to ensure we don't try to dereference a NULL pointer.\n+\t */\n+\tif (rqst[num_rqst].rq_iov)\n+\t\tSMB2_open_free(&rqst[num_rqst]);\n+\tnum_rqst++;\n \tif (rc == -EREMCHG) {\n \t\tpr_warn_once(\"server share %s deleted\\n\", tcon->tree_name);\n \t\ttcon->need_reconnect = true;\n","prefixes":["RFC"]}