]> rtime.felk.cvut.cz Git - zynq/linux.git/commitdiff
nvme-multipath: zero out ANA log buffer
authorHannes Reinecke <hare@suse.de>
Tue, 8 Jan 2019 11:46:58 +0000 (12:46 +0100)
committerChristoph Hellwig <hch@lst.de>
Wed, 9 Jan 2019 18:47:06 +0000 (13:47 -0500)
When nvme_init_identify() fails the ANA log buffer is deallocated
but _not_ set to NULL. This can cause double free oops when this
controller is deleted without ever being reconnected.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/host/multipath.c

index 183ec17ba0678a38047025209422fb7b24cc2944..df4b3a6db51bfdf8307e38da3cd568209266f0a5 100644 (file)
@@ -570,6 +570,7 @@ int nvme_mpath_init(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id)
        return 0;
 out_free_ana_log_buf:
        kfree(ctrl->ana_log_buf);
+       ctrl->ana_log_buf = NULL;
 out:
        return error;
 }
@@ -577,5 +578,6 @@ out:
 void nvme_mpath_uninit(struct nvme_ctrl *ctrl)
 {
        kfree(ctrl->ana_log_buf);
+       ctrl->ana_log_buf = NULL;
 }