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 C5D3A481244; Tue, 25 Aug 2026 13:35:36 +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=1787664942; cv=none; b=iXXF54ERZNj6X0nhni2IBgZkX3kjQl7HDJFWBJU2asXf4P0qUfZglMYc2N2WgWwC2qmHPklQnT9fSCCL/1B5TVUyhgUTMOmV/X+RoIySJgCFN1agwxG4YsONGBc2MYeSJzvyAe3RvrhlrLAwXdIu7HoIN5zofhugJyStrrWPboY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787664942; c=relaxed/simple; bh=Dj0Xfpy0Tub87bjSf5pwZoPXlJmTzQn1ET5H+wDuInQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VDKQudyZp3P2Suhi/E0A77zt/AT7S6YWtCkswwrKGlhviDBQEMU/1z/vVJnm2mo1qSy9yWusicA+ZtlFTW48SEUoYwUeqeoXPhs4ZqU1Ec1uhK2IXFzns+euOF0xqSJY3Ztp8IfD87XVl2Tf4IuttJIof/wApCLcxPlr86mff9s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Ze1XQGtG; 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="Ze1XQGtG" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2BAAF1F00A3A; Tue, 25 Aug 2026 13:35:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1787664936; bh=M4BAm7W4QnMR+2q58yWrJGAXCiK25bcNkJmWX7p4fw4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Ze1XQGtGDb/72amElpd9TUfxxRZLo4sOwvBRlhp+e3hRQfMgYE9+tlIB3M5j/Cva/ akyCxWmBu2jzwWcqec30+ftPFMd4T3Q9BwKVEPyxS116LYTcsiY7F6XTx47LKC6wkO fqDAbe71U76ReZ39xiTHk+XEnujAI+kXuXUkbuQc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, stable , Keith Busch Subject: [PATCH 7.1 056/101] nvmet-tcp: Do not WARN on remotely-controlled oversized SGL allocations Date: Tue, 25 Aug 2026 15:25:34 +0200 Message-ID: <20260825132544.195821398@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260825132541.986300899@linuxfoundation.org> References: <20260825132541.986300899@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 7.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 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/drivers/nvme/target/tcp.c +++ b/drivers/nvme/target/tcp.c @@ -446,13 +446,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_objs(*cmd->iov, cmd->req.sg_cnt); + cmd->iov = kmalloc_objs(*cmd->iov, cmd->req.sg_cnt, + GFP_KERNEL | __GFP_NOWARN); if (!cmd->iov) goto err; }