summaryrefslogtreecommitdiff
path: root/drivers/nvme
diff options
context:
space:
mode:
authorBart Van Assche <bart.vanassche@sandisk.com>2016-10-18 23:10:46 +0300
committerSagi Grimberg <sagi@grimberg.me>2016-12-06 11:17:03 +0300
commit8eadfcb1b63d7d9cd21dc7a2fd1d92efc5730ddd (patch)
treefe44c8570569435cea895ce45f3727b2ccef7fc3 /drivers/nvme
parent76c08bf46a2891c80e854813c636bdce1f7d1ca4 (diff)
downloadlinux-8eadfcb1b63d7d9cd21dc7a2fd1d92efc5730ddd.tar.xz
nvme-fabrics: Fix memory leaks in nvmf_parse_options()
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Diffstat (limited to 'drivers/nvme')
-rw-r--r--drivers/nvme/host/fabrics.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c
index 68fb26b3bfb9..12f19c4665cf 100644
--- a/drivers/nvme/host/fabrics.c
+++ b/drivers/nvme/host/fabrics.c
@@ -666,10 +666,12 @@ static int nvmf_parse_options(struct nvmf_ctrl_options *opts,
if (nqnlen >= NVMF_NQN_SIZE) {
pr_err("%s needs to be < %d bytes\n",
p, NVMF_NQN_SIZE);
+ kfree(p);
ret = -EINVAL;
goto out;
}
opts->host = nvmf_host_add(p);
+ kfree(p);
if (!opts->host) {
ret = -ENOMEM;
goto out;