[PATCH 5/6] nvmet_fc: Clear SG list to avoid double frees

jsmart2021 at gmail.com jsmart2021 at gmail.com
Thu Mar 23 20:41:26 PDT 2017


From: James Smart <jsmart2021 at gmail.com>

Clear SG list to avoid double frees of payload page list

Signed-off-by: James Smart <james.smart at broadcom.com>
Reviewed-by: Johannes Thumshirn <jthumshirn at suse.de>
---
 drivers/nvme/target/fc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/nvme/target/fc.c b/drivers/nvme/target/fc.c
index 3a0f22e..2c0709f 100644
--- a/drivers/nvme/target/fc.c
+++ b/drivers/nvme/target/fc.c
@@ -1624,6 +1624,8 @@ nvmet_fc_free_tgt_pgs(struct nvmet_fc_fcp_iod *fod)
 	for_each_sg(fod->data_sg, sg, fod->data_sg_cnt, count)
 		__free_page(sg_page(sg));
 	kfree(fod->data_sg);
+	fod->data_sg = NULL;
+	fod->data_sg_cnt = 0;
 }
 
 
-- 
2.9.3




More information about the Linux-nvme mailing list