[SRU][F][PATCH 1/1] nvme: avoid double free special payload
Koichiro Den
koichiro.den at canonical.com
Fri Sep 13 08:12:07 UTC 2024
From: Chunguang Xu <chunguang.xu at shopee.com>
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 at shopee.com>
Reviewed-by: Sagi Grimberg <sagi at grimberg.me>
Reviewed-by: Max Gurtovoy <mgurtovoy at nvidia.com>
Signed-off-by: Keith Busch <kbusch at kernel.org>
(backported from commit e5d574ab37f5f2e7937405613d9b1a724811e5ad)
[koichiroden: Adjusted context due to a missing commit
3973e15fa534 ("nvme: use bvec_virt")]
CVE-2024-41073
Signed-off-by: Koichiro Den <koichiro.den at canonical.com>
---
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 9144ed14b074..250e933020f9 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -765,6 +765,7 @@ void nvme_cleanup_cmd(struct request *req)
clear_bit_unlock(0, &ns->ctrl->discard_page_busy);
else
kfree(page_address(page) + req->special_vec.bv_offset);
+ req->rq_flags &= ~RQF_SPECIAL_PAYLOAD;
}
}
EXPORT_SYMBOL_GPL(nvme_cleanup_cmd);
--
2.43.0
More information about the kernel-team
mailing list