Skip to contentSkip to conversation

tcm_vhost: call kfree() on an error path

PATCH Applied Dan Carpenter 2 participants 3 messages Jul 12, 2012

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 3/3 tcm_vhost: call kfree() on an error path

There is a memory leak here.

drivers/vhost/tcm_vhost.c +1 -0
index 57d39c5..29850cb 100644
@@ -1420,6 +1420,7 @@ static struct se_wwn *tcm_vhost_make_tport(
 
 	pr_err("Unable to locate prefix for emulated Target Port:"
 			" %s\n", name);
+	kfree(tport);
 	return ERR_PTR(-EINVAL);
 
 check_len:
#1 lore raw
Quoted 9 lines · Dan Carpenter

There is a memory leak here.

drivers/vhost/tcm_vhost.c +0 -0
index 57d39c5..29850cb 100644

drivers/vhost/tcm_vhost.c static struct se_wwn *tcm_vhost_make_tport( · line 1426

Quoted 7 lines
drivers/vhost/tcm_vhost.c +1 -0
@@ -1420,6 +1420,7 @@ static struct se_wwn *tcm_vhost_make_tport(
 
 	pr_err("Unable to locate prefix for emulated Target Port:"
 			" %s\n", name);
+	kfree(tport);
 	return ERR_PTR(-EINVAL);
 
 check_len:

Applied to for-next-merge, and folding the series into the initial merge commit now..

Thank you!

--nab

#2 lore raw
In reply to Dan Carpenter
Quoted 9 lines · Dan Carpenter

There is a memory leak here.

drivers/vhost/tcm_vhost.c +0 -0
index 57d39c5..29850cb 100644

drivers/vhost/tcm_vhost.c static struct se_wwn *tcm_vhost_make_tport( · line 1426

Quoted 7 lines
drivers/vhost/tcm_vhost.c +1 -0
@@ -1420,6 +1420,7 @@ static struct se_wwn *tcm_vhost_make_tport(
 
 	pr_err("Unable to locate prefix for emulated Target Port:"
 			" %s\n", name);
+	kfree(tport);
 	return ERR_PTR(-EINVAL);
 
 check_len:

Applied to for-next-merge, and folding the series into the initial merge commit now..

Thank you!

--nab