* [PATCH AUTOSEL 5.15 3/3] nvme: avoid double free special payload
[not found] <20240623134538.810055-1-sashal@kernel.org>
@ 2024-06-23 13:45 ` Sasha Levin
0 siblings, 0 replies; only message in thread
From: Sasha Levin @ 2024-06-23 13:45 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Chunguang Xu, Sagi Grimberg, Max Gurtovoy, Keith Busch,
Sasha Levin, linux-nvme
From: Chunguang Xu <chunguang.xu@shopee.com>
[ Upstream commit e5d574ab37f5f2e7937405613d9b1a724811e5ad ]
If a discard request needs to be retried, and that retry may fail before
a new special payload is added, a double free will result. Clear the
RQF_SPECIAL_LOAD when the request is cleaned.
Signed-off-by: Chunguang Xu <chunguang.xu@shopee.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Max Gurtovoy <mgurtovoy@nvidia.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/nvme/host/core.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 960a31e3307a2..93a19588ae92a 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -981,6 +981,7 @@ void nvme_cleanup_cmd(struct request *req)
clear_bit_unlock(0, &ctrl->discard_page_busy);
else
kfree(bvec_virt(&req->special_vec));
+ req->rq_flags &= ~RQF_SPECIAL_PAYLOAD;
}
}
EXPORT_SYMBOL_GPL(nvme_cleanup_cmd);
--
2.43.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2024-06-23 13:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20240623134538.810055-1-sashal@kernel.org>
2024-06-23 13:45 ` [PATCH AUTOSEL 5.15 3/3] nvme: avoid double free special payload Sasha Levin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox