Commit 8fc1858a authored by Roland Dreier's avatar Roland Dreier Committed by James Bottomley

[SCSI] target: Fix memory leak on error path in pscsi_alloc_task

If allocation of pt->pscsi_cdb fails, we need to free the just-allocated
pt or else it will be leaked.
Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
Signed-off-by: default avatarNicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
parent 4b320305
...@@ -816,6 +816,7 @@ pscsi_alloc_task(struct se_cmd *cmd) ...@@ -816,6 +816,7 @@ pscsi_alloc_task(struct se_cmd *cmd)
if (!(pt->pscsi_cdb)) { if (!(pt->pscsi_cdb)) {
printk(KERN_ERR "pSCSI: Unable to allocate extended" printk(KERN_ERR "pSCSI: Unable to allocate extended"
" pt->pscsi_cdb\n"); " pt->pscsi_cdb\n");
kfree(pt);
return NULL; return NULL;
} }
} else } else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment