nvmet_fc: Clear SG list to avoid double frees
authorJames Smart <jsmart2021@gmail.com>
Fri, 24 Mar 2017 03:41:26 +0000 (20:41 -0700)
committerJens Axboe <axboe@fb.com>
Tue, 4 Apr 2017 15:48:23 +0000 (09:48 -0600)
Clear SG list to avoid double frees of payload page list

Signed-off-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
drivers/nvme/target/fc.c

index 3a0f22e..2c0709f 100644 (file)
@@ -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;
 }