public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] xen-blkback: add missing return on error in xen_update_blkif_status()
@ 2011-08-05 14:18 Dan Carpenter
  2011-08-05 15:05 ` Laszlo Ersek
  2011-08-06 14:46 ` Konrad Rzeszutek Wilk
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2011-08-05 14:18 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk; +Cc: Laszlo Ersek, Joe Jin, open list, kernel-janitors

We should return here after reporting the error.  Otherwise we'd hit
a NULL deref of blkif->xenblkd on the next line.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c
index 32d4c3c..b750299 100644
--- a/drivers/block/xen-blkback/xenbus.c
+++ b/drivers/block/xen-blkback/xenbus.c
@@ -107,6 +107,7 @@ static void xen_update_blkif_status(struct xen_blkif *blkif)
 		err = PTR_ERR(blkif->xenblkd);
 		blkif->xenblkd = NULL;
 		xenbus_dev_error(blkif->be->dev, err, "start xenblkd");
+		return;
 	}
 
 	blkif->be->kthread_pid = blkif->xenblkd->pid;

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

* Re: [patch] xen-blkback: add missing return on error in xen_update_blkif_status()
  2011-08-05 14:18 [patch] xen-blkback: add missing return on error in xen_update_blkif_status() Dan Carpenter
@ 2011-08-05 15:05 ` Laszlo Ersek
  2011-08-06 14:46 ` Konrad Rzeszutek Wilk
  1 sibling, 0 replies; 3+ messages in thread
From: Laszlo Ersek @ 2011-08-05 15:05 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Konrad Rzeszutek Wilk, Joe Jin, open list, kernel-janitors

On 08/05/11 16:18, Dan Carpenter wrote:
> We should return here after reporting the error.  Otherwise we'd hit
> a NULL deref of blkif->xenblkd on the next line.
>
> Signed-off-by: Dan Carpenter<error27@gmail.com>
>
> diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c
> index 32d4c3c..b750299 100644
> --- a/drivers/block/xen-blkback/xenbus.c
> +++ b/drivers/block/xen-blkback/xenbus.c
> @@ -107,6 +107,7 @@ static void xen_update_blkif_status(struct xen_blkif *blkif)
>   		err = PTR_ERR(blkif->xenblkd);
>   		blkif->xenblkd = NULL;
>   		xenbus_dev_error(blkif->be->dev, err, "start xenblkd");
> +		return;
>   	}
>
>   	blkif->be->kthread_pid = blkif->xenblkd->pid;

In case somebody were asking for my opinion:

I think this block was the last block in the originally containing 
function (update_blkif_status()?), thus the "return" wasn't needed 
there. I guess the block got copied and then other code was added below it.

Acked-by: Laszlo Ersek <lersek@redhat.com>

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

* Re: [patch] xen-blkback: add missing return on error in xen_update_blkif_status()
  2011-08-05 14:18 [patch] xen-blkback: add missing return on error in xen_update_blkif_status() Dan Carpenter
  2011-08-05 15:05 ` Laszlo Ersek
@ 2011-08-06 14:46 ` Konrad Rzeszutek Wilk
  1 sibling, 0 replies; 3+ messages in thread
From: Konrad Rzeszutek Wilk @ 2011-08-06 14:46 UTC (permalink / raw)
  To: Dan Carpenter, joe.jin; +Cc: Laszlo Ersek, Joe Jin, open list, kernel-janitors

On Fri, Aug 05, 2011 at 05:18:21PM +0300, Dan Carpenter wrote:
> We should return here after reporting the error.  Otherwise we'd hit
> a NULL deref of blkif->xenblkd on the next line.

Whao, yeah, I dropped that whole patchset. Will introduce it back
in when I get a better patchset from Joe.

Joe,
Can you add this fix in your patchqueue please?

> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> 
> diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c
> index 32d4c3c..b750299 100644
> --- a/drivers/block/xen-blkback/xenbus.c
> +++ b/drivers/block/xen-blkback/xenbus.c
> @@ -107,6 +107,7 @@ static void xen_update_blkif_status(struct xen_blkif *blkif)
>  		err = PTR_ERR(blkif->xenblkd);
>  		blkif->xenblkd = NULL;
>  		xenbus_dev_error(blkif->be->dev, err, "start xenblkd");
> +		return;
>  	}
>  
>  	blkif->be->kthread_pid = blkif->xenblkd->pid;

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

end of thread, other threads:[~2011-08-06 14:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-05 14:18 [patch] xen-blkback: add missing return on error in xen_update_blkif_status() Dan Carpenter
2011-08-05 15:05 ` Laszlo Ersek
2011-08-06 14:46 ` Konrad Rzeszutek Wilk

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