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=1796382947; b=5t2NSWW3ECFE0GCil2YhA3mexirzXJpD68d+KEYZsFG8fOC5xR6OQUT0e0wzRRH7Bb+r HpZTGJdGGOAhchwiFL3/reHVukU7y3yfGc3o3kCs0dYqwas3YtHdyHNU8AIM/SKEabjMZ 8eb0rOoQr8cZqZ3YmiYRDgDO6UTbpe9aH+riX/eyuZ6wA9AtZ0pYXN7hUiFDifNmUDwMg ar/RFaM3F+3+VILbQ/9wXdPMCmPxRYD1/HFz5ZRWouxrEuZHgq6k7xBpsuSxm/zI2vbDA jst0fXmLDir48Rdf1gmoS6ZHetebjm6TwBfBmwufliY0hTZ90ShRa7Fkban7NroM84Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796382947; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=6E0VWUBmEDjZXp6sRTSCx6ZWQmAyZNxlOK6cRQUzHjM=; b=lJzsszJkJSrS6z9fgXDhAE1TXWJ0sPWEuBP+4iGtVRCawkyDLD3CCWQq/CdreRTNwWXX YeudHg5xsGEj1xodIk/iAdlRg8BvnRPJiwDSekyd3sbELU2/Ug4t7/uOIAvbCSHFGb5kK o8/rYofgeH52CZoXhAu94lyQsoeuoBuZSSSNk91eZSo1z8nFTO10/ACccU0oPGXuJkXc7 jynivSnjfQfzgTDLdrbbbyJ+eql0MK6TqKABrbiqUUaHdPBuAtV79soLY+D7Wcqpdqx+E H11MayT70mBggUjNpXnEq26gur8uGy4ADHMH5Y+ptAuCT5G19C2eiCz9wB9HgO9Exdg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=HeWAjM0w; 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 45746606A322; Fri, 4 Dec 2026 11:15:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=HeWAjM0w Received: by smtp.kernel.org (Postfix) with ESMTPSA id BACB81F000C2; Fri, 4 Dec 2026 11:15:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796382947; bh=6E0VWUBmEDjZXp6sRTSCx6ZWQmAyZNxlOK6cRQUzHjM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=HeWAjM0wePsJQRb0LvB8mq7QyaWAsW4N0EW7REiG5/x/fuVecJhWXIEg+xScZruo9 OjLujeqwm8mgp3xMGlA+ZzY4AJtoV6r/duBk/brcWc/sO9r9qw/4SMHGdR+C18ya4U UE4923HBikpRP514KDeNzKAFzy+gES7LFE+5EP0k= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Hannes Reinecke , Christoph Hellwig , Nilay Shroff , Guixin Liu , Keith Busch , Sasha Levin Subject: [PATCH 6.18 660/703] nvmet: use GFP_KERNEL for PR allocations Date: Fri, 4 Dec 2026 19:09:19 +0900 Message-ID: <20261204100645.339979819@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100627.522266145@linuxfoundation.org> References: <20261204100627.522266145@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ 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 Signed-off-by: Greg Kroah-Hartman --- drivers/nvme/target/pr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/nvme/target/pr.c +++ b/drivers/nvme/target/pr.c @@ -341,7 +341,7 @@ static u16 nvmet_pr_update_reg_attr(stru 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_ 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;