Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1347922 > unrolled thread

[patch] tcm_loop: use after free on error

Started byDan Carpenter <dan.carpenter@oracle.com>
First post2016-03-02 11:20 +0100
Last post2016-03-03 14:50 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [patch] tcm_loop: use after free on error Dan Carpenter <dan.carpenter@oracle.com> - 2016-03-02 11:20 +0100
    Re: [patch] tcm_loop: use after free on error Tomas Henzl <thenzl@redhat.com> - 2016-03-03 14:50 +0100

#1347922 — [patch] tcm_loop: use after free on error

FromDan Carpenter <dan.carpenter@oracle.com>
Date2016-03-02 11:20 +0100
Subject[patch] tcm_loop: use after free on error
Message-ID<r8c2S-6eY-15@gated-at.bofh.it>
We dereference "tl_nexus" to get the error code.

Fixes: 1b418a8fcbc0 ('target: Convert demo-mode only drivers to target_alloc_session')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c
index 0216c75..e0ffb03 100644
--- a/drivers/target/loopback/tcm_loop.c
+++ b/drivers/target/loopback/tcm_loop.c
@@ -808,6 +808,7 @@ static int tcm_loop_make_nexus(
 {
 	struct tcm_loop_hba *tl_hba = tl_tpg->tl_hba;
 	struct tcm_loop_nexus *tl_nexus;
+	int ret;
 
 	if (tl_tpg->tl_nexus) {
 		pr_debug("tl_tpg->tl_nexus already exists\n");
@@ -824,8 +825,9 @@ static int tcm_loop_make_nexus(
 					TARGET_PROT_DIN_PASS | TARGET_PROT_DOUT_PASS,
 					name, tl_nexus, NULL);
 	if (IS_ERR(tl_nexus->se_sess)) {
+		ret = PTR_ERR(tl_nexus->se_sess);
 		kfree(tl_nexus);
-		return PTR_ERR(tl_nexus->se_sess);
+		return ret;
 	}
 
 	tl_tpg->tl_nexus = tl_nexus;

[toc] | [next] | [standalone]


#1349166

FromTomas Henzl <thenzl@redhat.com>
Date2016-03-03 14:50 +0100
Message-ID<r8BND-7MX-7@gated-at.bofh.it>
In reply to#1347922
On 2.3.2016 11:09, Dan Carpenter wrote:
> We dereference "tl_nexus" to get the error code.
>
> Fixes: 1b418a8fcbc0 ('target: Convert demo-mode only drivers to target_alloc_session')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Reviewed-by: Tomas Henzl <thenzl@redhat.com>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web