Pārlūkot izejas kodu

nvme: fixup memory leak in nvme_init_identify()

If nvme_get_effects_log() failed the 'id' buffer from the previous
nvme_identify_ctrl() call will never be freed.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Hannes Reinecke 7 gadi atpakaļ
vecāks
revīzija
75c8b19a23
1 mainītis faili ar 1 papildinājumiem un 1 dzēšanām
  1. 1 1
      drivers/nvme/host/core.c

+ 1 - 1
drivers/nvme/host/core.c

@@ -2316,7 +2316,7 @@ int nvme_init_identify(struct nvme_ctrl *ctrl)
 	if (id->lpa & NVME_CTRL_LPA_CMD_EFFECTS_LOG) {
 	if (id->lpa & NVME_CTRL_LPA_CMD_EFFECTS_LOG) {
 		ret = nvme_get_effects_log(ctrl);
 		ret = nvme_get_effects_log(ctrl);
 		if (ret < 0)
 		if (ret < 0)
-			return ret;
+			goto out_free;
 	}
 	}
 
 
 	if (!ctrl->identified) {
 	if (!ctrl->identified) {