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 C380946EF65; Tue, 25 Aug 2026 13:53:42 +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=1787666028; cv=none; b=jgO97shxjRs80gJEA2H+XIzudgPeSxsV22xCpz37M95w0QREhMCoZrgT8yk6HdbkbmtKbkwcyRglI7ED7jHqcD9msLITfv36Tnpo1B+UHRvosM1UgqJnbeLccNgQ++vL1ehq8j7oDs0MJDTS6T1SmS/d4y8zqaEvsBih0rVh/8A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787666028; c=relaxed/simple; bh=iMSpQSBkjezXtTERwyC9DrWHnu8t9cuujLpfQGaH4mg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AwjV2rcWHhTCV+moOGbHwPlxWQM1iPe6OL7ofvGNCEegQYq3bNQFsepD5VCNZJ9bf4ok5pT2cGI9ws7wn0bs4QeFLTyAcPzmW3yAOpdGtjuDE7eudA9WY+lSEMTjaYB5x5g2uOpz+PiPOmjvl67xYfeKwzxNs8KT30b4ryoTcfA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=uEkvGdd+; 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="uEkvGdd+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 20BA21F000E9; Tue, 25 Aug 2026 13:53:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1787666022; bh=nMYcchDUbeZHY73TJccgPIpVTDtEDaHotFQoSW1lFds=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=uEkvGdd+OX4zT+bEFgKZzsbf5Iiw3AS/VN3X5ZA05h6VxmBVQYc8gM/zSH8MztQfI p99eMrIBbFBXeH3vjp9HebKkw18buV4cVLSXgihe1FKAyHN8BtbhAVOqmU+vS2UnUP C8rtflfsqM9YWMZ53VXhmmG3xtGBtojjZb03VnX8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, stable , Keith Busch Subject: [PATCH 6.1 59/79] nvmet-tcp: Do not WARN on remotely-controlled oversized SGL allocations Date: Tue, 25 Aug 2026 15:26:39 +0200 Message-ID: <20260825132544.000395822@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260825132541.677185791@linuxfoundation.org> References: <20260825132541.677185791@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.1-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 @@ -401,14 +401,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; }