public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] tcm_loop: use after free on error
@ 2016-03-02 10:09 Dan Carpenter
  2016-03-03 13:44 ` Tomas Henzl
  2016-03-05  7:21 ` Nicholas A. Bellinger
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2016-03-02 10:09 UTC (permalink / raw)
  To: Nicholas A. Bellinger, Christoph Hellwig
  Cc: Hannes Reinecke, Bart Van Assche, Sheng Yang, linux-scsi,
	target-devel, linux-kernel, kernel-janitors

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;

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [patch] tcm_loop: use after free on error
  2016-03-02 10:09 [patch] tcm_loop: use after free on error Dan Carpenter
@ 2016-03-03 13:44 ` Tomas Henzl
  2016-03-05  7:21 ` Nicholas A. Bellinger
  1 sibling, 0 replies; 3+ messages in thread
From: Tomas Henzl @ 2016-03-03 13:44 UTC (permalink / raw)
  To: Dan Carpenter, Nicholas A. Bellinger, Christoph Hellwig
  Cc: Hannes Reinecke, Bart Van Assche, Sheng Yang, linux-scsi,
	target-devel, linux-kernel, kernel-janitors

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>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] tcm_loop: use after free on error
  2016-03-02 10:09 [patch] tcm_loop: use after free on error Dan Carpenter
  2016-03-03 13:44 ` Tomas Henzl
@ 2016-03-05  7:21 ` Nicholas A. Bellinger
  1 sibling, 0 replies; 3+ messages in thread
From: Nicholas A. Bellinger @ 2016-03-05  7:21 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Christoph Hellwig, Hannes Reinecke, Bart Van Assche, Sheng Yang,
	linux-scsi, target-devel, linux-kernel, kernel-janitors

On Wed, 2016-03-02 at 13:09 +0300, 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>
> 
> 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;

Also fixed + squashed into HCH's original patch.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-03-05  7:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-02 10:09 [patch] tcm_loop: use after free on error Dan Carpenter
2016-03-03 13:44 ` Tomas Henzl
2016-03-05  7:21 ` Nicholas A. Bellinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox