Skip to contentSkip to conversation

nvme: avoid double free special payload

PATCH New d.privalov 1 participant 1 message Dec 26, 2024 NVMe

lore
Share & tools
lore

d.privalov

author
#0 lore raw

PATCH 1/1 nvme: avoid double free special payload

From: Chunguang Xu <[email protected]>

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.

---
 drivers/nvme/host/core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/nvme/host/core.c +1 -0
index bee55902fe6c..3ae757ee8943 100644
@@ -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);
Signature · 1 line
2.34.1