From nobody Wed Jun 17 05:14:12 2026 Received: from mail-dl1-f48.google.com (mail-dl1-f48.google.com [74.125.82.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 14C4D38DD3 for ; Tue, 28 Apr 2026 02:52:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777344740; cv=none; b=JncQ/eEQVOEYfMiUsYXXDaKEd8zSZxjzR0HzvLIz36neqIAt4tE2N2aMmksTDqo0YuMIwtiipVV+TbEGltwSPRSymJe+lmH38pG0ZW2vA7lSh2upeSlQ9LyinJugZETna+r886aB20SR9Als9bMfwjPLgESt8DOHUKt19CzmTH4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777344740; c=relaxed/simple; bh=TkoPdIVnEDDcQkPQIK1u6AA2DgP5kx9+S9MtA08CmZY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=NFEeqgsCI1zoEYli3YenX/upoLHm8xUZHwGjbRXRrh5cxbUruGXKGDUTZrM6ZXA5AOCjIQ4Cp3Lp8GswEesHm4JpP5OKzpDZHAHJ+ac/gXreI7/UJU64Jfyd7r+vzBY2kcKuNlORp3aBMZqPgyZ3Bvfni03P26S3ptWAruv9D94= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=tIHGAWKO; arc=none smtp.client-ip=74.125.82.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="tIHGAWKO" Received: by mail-dl1-f48.google.com with SMTP id a92af1059eb24-12c45281a06so14862222c88.1 for ; Mon, 27 Apr 2026 19:52:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777344738; x=1777949538; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=a8Nhk45wzO3zlFt88EGGS6yZ3Zatdszo/GvXIEznylg=; b=tIHGAWKO69bmUBlcVuZ9ibWlVt9fv12KA46fvx0WfMitONXTEBr5dK4ioRvTQwURoS bdwqgGD4lrT6Ct8VPgvFp8qOJd3OBVk9P51LV2iZpaufh4v5zsl5VdhAGc/pJLHEtj7J f1qkEwVLNtUo7+UaoZC0y5bTQp8mCRjpFkigR0JKCPBSGI2EbvRY/myGstH68oqm+Ub5 nYD7SWv0RLpeM5kPc6Rivie8ayRSO+DDgTskQVYZRSYK0A7urXOT0UIiU9J8zfljrK91 qDnAerWk0EckTjFRXPB0GfXLONzYL/3W2hJ0EHTu0v33meZg4rvpto1enmT6bXuTPU5Z 6ihA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777344738; x=1777949538; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=a8Nhk45wzO3zlFt88EGGS6yZ3Zatdszo/GvXIEznylg=; b=jt53SiZkZxEU9HvJ8RygMglZRzLkcZXa10eWoYoMrsqN233l9bqvS1ZvbAo8offrLZ 1PH5bGEO0LOcYxNbUPvWLNoW8/ssXOm9R20alO5t5dQTW+YDgQM6iAWIJqiqhbwme4jN HTkg5Nj5vOlF41KVMQ1ftPfmFhPRM713uhwbR55GZUrkk2hmglSdUk9C22P/cz+rl4xm XO0u9/LG9eWOZKf+5s1SP5bHaQbNoXIlcIAKnYW0gkf2jCQGEbnMCXSVm7NNDEV/t8H3 DGpe56Rw3NugS5281xjiyjtucINBVdHprCIQn96oSEB+8d+VPmr3OdwZ+uCKPlLs7LQW g0BA== X-Forwarded-Encrypted: i=1; AFNElJ92dfW8XnlaW8uoJbvEUj0sDo42pN96Jc/XLiF7/us/Ivw/w/rhg/Qyp/EXYUItsjwnXDOEz68Ntea/2S8=@vger.kernel.org X-Gm-Message-State: AOJu0YxpZxDgsm8Svm2VYqIAstCAnr0Dq3caGd54jltxgH5NGXrTTBwY FFERbE5JFd/+K8lo3RGqqcOtwJHLFORE3ShgDQUoE+LisN3YrUqJPPcq X-Gm-Gg: AeBDievr85fDbGNEn8OT1YSaa2jqeX4ELoUjEmiVoRzLZsUZfoFPEn/bkxd9IaCim5W W/5JhO8cNr0K00s6GE3FTOQoF6o6XATTo0yKnfwzhjm3NGWMvke3bZgilVTRQD4/LnPMDNNKC8h rGnpJVtopOgtl10fzDEgcCjClVDEeL+gjRb5sP0vtRMAHwLmVXgu0ekMEXIifSVPli4p7OPgVff J17588vd9IlzowUFJkrvZxXC/lQoabzu+40nrNwXGyoq2tssONjnRie10qwkSPu/1joAzgRB4Ed moSkLP87uL98q73ADWWWmsh3YFphZKt4LKoHtV6UDr7sPeGdxpdCM9VMHluwFGS5cG922lEAIB8 duzh+hbqrBCCek4YU9krTDUpj+F1FeajlNppZ7TZCsqqlTrMUlz1dJWLdADF4IZKab8FT4sX+3g 4tuyEcSXnuF/kWCWNHNXG0Fg8xvYtHlZ1jrZ25XKj8lI07YDYEMl/feE66RdPBDpuZ3dda4Hma/ eyjvt7wyRo14vrGoujzyQ== X-Received: by 2002:a05:7022:eacd:b0:12c:2cf8:2f30 with SMTP id a92af1059eb24-12ddd9614a5mr665176c88.15.1777344738072; Mon, 27 Apr 2026 19:52:18 -0700 (PDT) Received: from FredPC.wirelessinternet (mobile-166-176-187-202.mycingular.net. [166.176.187.202]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-12ddd9a63a7sm1210664c88.11.2026.04.27.19.52.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Apr 2026 19:52:17 -0700 (PDT) From: Fredric Cover X-Google-Original-From: Fredric Cover To: Steve French , Paulo Alcantara Cc: linux-cifs@vger.kernel.org, linux-kernel@vger.kernel.org, Fredric Cover Subject: [PATCH RFC] smb: client: fix NULL pointer dereference in 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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Fredric Cover When a valid cfile is passed to smb2_compound_op, the code uses a goto to jump to the 'after_open' label. This bypasses the initialization of rqst[0] by SMB2_open_init(). However, the 'finished' cleanup block unconditionally attempts to call SMB2_open_free() on rqst[0]. If SMB2_open_init() was skipped, rqst[0].rq_iov is NULL, leading to a NULL pointer dereference. Check for a valid rq_iov before attempting to free the request to prevent the crash in handle-reuse scenarios. Signed-off-by: Fredric Cover --- I am new to writing code for the Linux kernel. Please be patient with me and feel free to point out any obvious mistakes I made.=20 I tested this patch in a user-space skeleton clone using ASan. I only have access to a shallow clone and cannot find the=20 original commit for the 'Fixes:' line. --- fs/smb/client/smb2inode.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/fs/smb/client/smb2inode.c b/fs/smb/client/smb2inode.c index c6dd282fc..aed96eeba 100644 --- a/fs/smb/client/smb2inode.c +++ b/fs/smb/client/smb2inode.c @@ -552,7 +552,13 @@ static int smb2_compound_op(const unsigned int xid, st= ruct cifs_tcon *tcon, =20 finished: num_rqst =3D 0; - SMB2_open_free(&rqst[num_rqst++]); + /* + * If cfile was passed, the open was skipped; check rq_iov + * to ensure we don't try to dereference a NULL pointer. + */ + if (rqst[num_rqst].rq_iov) + SMB2_open_free(&rqst[num_rqst]); + num_rqst++; if (rc =3D=3D -EREMCHG) { pr_warn_once("server share %s deleted\n", tcon->tree_name); tcon->need_reconnect =3D true; --=20 2.43.0