[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20241226092751.43612-1-d.privalov@omp.ru>
Date: Thu, 26 Dec 2024 12:27:51 +0300
From: d.privalov <d.privalov@....ru>
To: Keith Busch <kbusch@...nel.org>
CC: Jens Axboe <axboe@...com>, Christoph Hellwig <hch@....de>, Sagi Grimberg
<sagi@...mberg.me>, <linux-nvme@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>, <lvc-project@...uxtesting.org>, Chunguang Xu
<chunguang.xu@...pee.com>, Max Gurtovoy <mgurtovoy@...dia.com>, Dmitriy
Privalov <d.privalov@....ru>
Subject: [PATCH 5.10 1/1] nvme: avoid double free special payload
From: Chunguang Xu <chunguang.xu@...pee.com>
commit e5d574ab37f5f2e7937405613d9b1a724811e5ad upstream.
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@...pee.com>
Reviewed-by: Sagi Grimberg <sagi@...mberg.me>
Reviewed-by: Max Gurtovoy <mgurtovoy@...dia.com>
Signed-off-by: Keith Busch <kbusch@...nel.org>
Signed-off-by: Dmitriy Privalov <d.privalov@....ru>
---
drivers/nvme/host/core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index bee55902fe6c..3ae757ee8943 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -852,6 +852,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.34.1
Powered by blists - more mailing lists