From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796361193; b=W6zocMVLp23NMkl5AYRb9j+rhcO4nfONhIHRkibKTw8v4Vm9rNpH8z/MPLXu1mBUt+Bp 1naxj5WLVOWtAMhqhMnwW1rP560r8zXxrs+DwIN8OdqjeGRsRPh5KA7nF8WgptLl40uCb 5s42Xesx+s40PGP+FqC8pYsJ4/t2SsYN3/Fw4qTCXSc19DtGCLR5IS3gwoStFM2d4ZVQc aREaPt0vin/sfJJmq5BdY+RkPaEBsY1qMMQodpTlQcO0s3wJ0L2mxVx9vHY0MOBDdiB1Z Lj8+O9ZuGyvdYsHpuFxlV7kV9W22bh0/q/KFc5bTnyOeezVaeRcejc6H4KOs657XbWg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796361193; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=xmPfwMwHzPBmf7W4UqYPoid4rC6NHzHmcBtSfYkSboY=; b=izsXcouiihg5TUsSXlMHP0UAeALuFiQSbBVviJg5Vf+CITZQvOMpb0r3JZkXP2bc3tjK M2OK3Bnjmy9EB4ceFz7audd95sYChWey/cUhJMLGnwUMJvmT1LFcwU9FQqbSCFedivlJ1 b0QnqBNooU833zsq1NyWsC2tehuTZjafyWeQF1GbWVuuTx+TtZBPG1hMbkuMaQNl4i7dx xIrl/Wx5WaHEX0XJcoRZKSlm5AFsfl4of+9GURnvdJr9OzJS4jZJC6e1Wm2GX1GizZnoJ QqlorpCVlbCHi4nYL1/AidevCUZGuTFNYnf6j98p3ePy2kZzOYLVDx7H/IQwnbUOEeA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=F76KVRVJ; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EEA18606A322 for ; Fri, 4 Dec 2026 05:13:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=F76KVRVJ Received: by smtp.kernel.org (Postfix) with ESMTPSA id 99AC81F000C2; Fri, 4 Dec 2026 05:13:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796361192; bh=xmPfwMwHzPBmf7W4UqYPoid4rC6NHzHmcBtSfYkSboY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=F76KVRVJ6H6xmIFwcQxRAQyYDvEr9gqKT5gxV6uMDTqcFGu60QgI9Z7YVyvRJb31J D45cZSj0KtCbxJMQu8WGA0GVTJN087gg1ze+DnwWWcKUB9NP3QjQo1cG8mlxWMirbp l813bD7Jfckcrz5XScE4XjygGmmkVid4EjTHIGUkRxlEWVCDevdtk9XSPf6ev9G8ED s5NKQxxctDZiac4tPNEpq/o3+m0llRCN2Ma7dcYHPkhIY8pA+nR5GD/uxTgQ0yrafH qTvpwm5oJiYzQ1BkU4SnBbs4kaFbUxXaaPMWz8vVzePGfU3y/aDIXrDei8GIH/+H3T IvcenPjUbjR8A== From: Sasha Levin To: stable@vger.kernel.org Cc: Guixin Liu , Hannes Reinecke , Christoph Hellwig , Nilay Shroff , Keith Busch , Sasha Levin Subject: [PATCH 6.18.y] nvmet: use GFP_KERNEL for PR allocations Date: Fri, 4 Dec 2026 00:13:10 -0500 Message-ID: <20261204051250.2736553-1-sashal@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <2026120231-footprint-eligible-a023@gregkh> References: <2026120231-footprint-eligible-a023@gregkh> X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Guixin Liu [ Upstream commit 976311c5594a7a26047891f087ad59a804e02baa ] nvmet_pr_update_reg_attr() and nvmet_pr_alloc_and_insert_pc_ref() allocate with GFP_ATOMIC, but both run in sleepable context: the PR command handlers execute from the transport workqueues and take the pr_sem semaphore, and the pc_ref allocation is reached from the connect and configfs paths. The latter function even passes GFP_KERNEL to the percpu_ref_init() in the same scope, so the GFP_ATOMIC only raises the failure rate for no reason. Switch both allocations to GFP_KERNEL. Fixes: 5a47c2080a73 ("nvmet: support reservation feature") Cc: stable@vger.kernel.org Reviewed-by: Hannes Reinecke Reviewed-by: Christoph Hellwig Reviewed-by: Nilay Shroff Signed-off-by: Guixin Liu Signed-off-by: Keith Busch [ sashal: Kept the existing kmalloc(sizeof(*ptr), ...) allocation form instead of kmalloc_obj() in the context lines, while still switching both GFP_ATOMIC flags to GFP_KERNEL. ] Signed-off-by: Sasha Levin --- drivers/nvme/target/pr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/nvme/target/pr.c b/drivers/nvme/target/pr.c index 7ce7b179467f2..f10040d023128 100644 --- a/drivers/nvme/target/pr.c +++ b/drivers/nvme/target/pr.c @@ -341,7 +341,7 @@ static u16 nvmet_pr_update_reg_attr(struct nvmet_pr *pr, return NVME_SC_SUCCESS; } - new = kmalloc(sizeof(*new), GFP_ATOMIC); + new = kmalloc(sizeof(*new), GFP_KERNEL); if (!new) return NVME_SC_INTERNAL; @@ -1046,7 +1046,7 @@ static int nvmet_pr_alloc_and_insert_pc_ref(struct nvmet_ns *ns, struct nvmet_pr_per_ctrl_ref *pc_ref; int ret; - pc_ref = kmalloc(sizeof(*pc_ref), GFP_ATOMIC); + pc_ref = kmalloc(sizeof(*pc_ref), GFP_KERNEL); if (!pc_ref) return -ENOMEM; -- 2.53.0