From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 A5D4B391E4C; Tue, 25 Aug 2026 13:45:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787665528; cv=none; b=CFfwJZEB3fB/VSRraOoqUN07KOP+xN3tMvt3+iHmhVlpXTKTwG/y+/M06YOCQvxcdBWx5whnG9E0wZiY7/+0cNSGPWSJ1f9i4tFxhy2nADRiHIMABhJ1dRELNknr4PoKslGorXUeKUno598uwahXzIfsm3af2rnSwPMrP1Z7D0I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787665528; c=relaxed/simple; bh=CXk8Kdeg6MBtKvhfbGIPO/V1yI5/y+U13Th7UGLKv40=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JBu2/DwdlxqLR6wtHsHCpcAD2OXK08LcLsOVzgeI/DQttePJDnLBhqxiyIuV8XHHKbp3wnG869fggo9M3In2kJZs22x3vGInpM23iqxi+j2FZxVwZetA6y8R/Ov84+MeXYUd97GVK8liC9I35odL4VoHxFLnRODXagG5KYZJzz8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=k6ed4tBC; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="k6ed4tBC" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 03D9B1F00A3A; Tue, 25 Aug 2026 13:45:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1787665522; bh=nXtdTDXmOeOSlELO+vWxplZwDA+xJtiSSXRquY4u28k=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=k6ed4tBC8NgrHwv8wxrJeftTK/SH8CfgRAWaHMDFRHakZL0fayfRA4RYv2hF59nCr QOBwvCgap7FhIoiuXLTIr/Zvx+LziUPmfBrmlWS/sSCouoaCXRc8IqEIKCnsVYmI+h xCz8aEx2/RfXix15WFJ4MIioWeGBh5VIblvRrYAY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, stable , Keith Busch Subject: [PATCH 6.12 52/77] nvmet-tcp: Do not WARN on remotely-controlled oversized SGL allocations Date: Tue, 25 Aug 2026 15:26:14 +0200 Message-ID: <20260825132543.599946767@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260825132541.580275153@linuxfoundation.org> References: <20260825132541.580275153@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 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Greg Kroah-Hartman commit 737a3b535247226f6e1a7988fd9d6e63e7d6fc71 upstream. When fuzzing the nvme target code, I tripped a kernel warning in nvmet_tcp_map_data() because the length passed into the allocator is controlled by the remote initiator. A remote initiator that sends a command with an SGL claiming a huge number, can create a scatterlist and iovec allocation of over 1 million entries, which causes the backing kmalloc call to exceed MAX_PAGE_ORDER and then the page allocator will trip on a WARN_ON_ONCE_GFP() message: WARNING: mm/page_alloc.c:5280 __alloc_frozen_pages_noprof Workqueue: nvmet_tcp_wq nvmet_tcp_io_work ... sgl_alloc_order nvmet_tcp_map_data nvmet_tcp_try_recv_pdu As it's never good to trip a kernel warning remotely due to many systems having panic-on-warn enabled, let's silence it by just add GFP_NOWARN to the allocation flags. Assisted-by: gkh_clanker_2000 Cc: stable Signed-off-by: Greg Kroah-Hartman Signed-off-by: Keith Busch Signed-off-by: Greg Kroah-Hartman --- drivers/nvme/target/tcp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/drivers/nvme/target/tcp.c +++ b/drivers/nvme/target/tcp.c @@ -465,14 +465,15 @@ static int nvmet_tcp_map_data(struct nvm } cmd->req.transfer_len += len; - cmd->req.sg = sgl_alloc(len, GFP_KERNEL, &cmd->req.sg_cnt); + cmd->req.sg = sgl_alloc(len, GFP_KERNEL | __GFP_NOWARN, + &cmd->req.sg_cnt); if (!cmd->req.sg) return NVME_SC_INTERNAL; cmd->cur_sg = cmd->req.sg; if (nvmet_tcp_has_data_in(cmd)) { cmd->iov = kmalloc_array(cmd->req.sg_cnt, - sizeof(*cmd->iov), GFP_KERNEL); + sizeof(*cmd->iov), GFP_KERNEL | __GFP_NOWARN); if (!cmd->iov) goto err; }