All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xen-blkfront: plug device number leak in xlblk_init() error path
@ 2011-10-07 19:34 Laszlo Ersek
  2011-10-10 13:02 ` Ian Campbell
  0 siblings, 1 reply; 3+ messages in thread
From: Laszlo Ersek @ 2011-10-07 19:34 UTC (permalink / raw)
  To: xen-devel, lersek

... though after a failed xenbus_register_frontend() all may be lost.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 drivers/block/xen-blkfront.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index 9ea8c25..a5a9b1b 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -1385,6 +1385,8 @@ static struct xenbus_driver blkfront = {
 
 static int __init xlblk_init(void)
 {
+	int ret;
+
 	if (!xen_domain())
 		return -ENODEV;
 
@@ -1394,7 +1396,13 @@ static int __init xlblk_init(void)
 		return -ENODEV;
 	}
 
-	return xenbus_register_frontend(&blkfront);
+	ret = xenbus_register_frontend(&blkfront);
+	if (ret) {
+		unregister_blkdev(XENVBD_MAJOR, DEV_NAME);
+		return ret;
+	}
+
+	return 0;
 }
 module_init(xlblk_init);
 
-- 
1.7.4.4

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

* Re: [PATCH] xen-blkfront: plug device number leak in xlblk_init() error path
  2011-10-07 19:34 [PATCH] xen-blkfront: plug device number leak in xlblk_init() error path Laszlo Ersek
@ 2011-10-10 13:02 ` Ian Campbell
  2011-10-10 16:06   ` Konrad Rzeszutek Wilk
  0 siblings, 1 reply; 3+ messages in thread
From: Ian Campbell @ 2011-10-10 13:02 UTC (permalink / raw)
  To: Laszlo Ersek, Konrad Rzeszutek Wilk, Jeremy Fitzhardinge
  Cc: xen-devel@lists.xensource.com

Cc'ing Konrad & Jeremy per get_maintainers.pl

On Fri, 2011-10-07 at 20:34 +0100, Laszlo Ersek wrote:
> ... though after a failed xenbus_register_frontend() all may be lost.

Indeed. But anyway:

Acked-by: Ian Campbell <ian.campbell@citrix.com>

{net,kbd,fb,pci}front seem to not have this issue. Although it's not
100% clear if the effect of pci_frontend_registrar(1) needs to be
undone.

(is registrar a typo for register here?)


> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  drivers/block/xen-blkfront.c |   10 +++++++++-
>  1 files changed, 9 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
> index 9ea8c25..a5a9b1b 100644
> --- a/drivers/block/xen-blkfront.c
> +++ b/drivers/block/xen-blkfront.c
> @@ -1385,6 +1385,8 @@ static struct xenbus_driver blkfront = {
>  
>  static int __init xlblk_init(void)
>  {
> +	int ret;
> +
>  	if (!xen_domain())
>  		return -ENODEV;
>  
> @@ -1394,7 +1396,13 @@ static int __init xlblk_init(void)
>  		return -ENODEV;
>  	}
>  
> -	return xenbus_register_frontend(&blkfront);
> +	ret = xenbus_register_frontend(&blkfront);
> +	if (ret) {
> +		unregister_blkdev(XENVBD_MAJOR, DEV_NAME);
> +		return ret;
> +	}
> +
> +	return 0;
>  }
>  module_init(xlblk_init);
>  

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

* Re: [PATCH] xen-blkfront: plug device number leak in xlblk_init() error path
  2011-10-10 13:02 ` Ian Campbell
@ 2011-10-10 16:06   ` Konrad Rzeszutek Wilk
  0 siblings, 0 replies; 3+ messages in thread
From: Konrad Rzeszutek Wilk @ 2011-10-10 16:06 UTC (permalink / raw)
  To: Ian Campbell
  Cc: Jeremy Fitzhardinge, Laszlo Ersek, xen-devel@lists.xensource.com

On Mon, Oct 10, 2011 at 02:02:25PM +0100, Ian Campbell wrote:
> Cc'ing Konrad & Jeremy per get_maintainers.pl
> 
> On Fri, 2011-10-07 at 20:34 +0100, Laszlo Ersek wrote:
> > ... though after a failed xenbus_register_frontend() all may be lost.
> 
> Indeed. But anyway:
> 
> Acked-by: Ian Campbell <ian.campbell@citrix.com>

Queue up for 3.2.
> 
> {net,kbd,fb,pci}front seem to not have this issue. Although it's not
> 100% clear if the effect of pci_frontend_registrar(1) needs to be
> undone.
> 
> (is registrar a typo for register here?)

Yes.

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

end of thread, other threads:[~2011-10-10 16:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-07 19:34 [PATCH] xen-blkfront: plug device number leak in xlblk_init() error path Laszlo Ersek
2011-10-10 13:02 ` Ian Campbell
2011-10-10 16:06   ` Konrad Rzeszutek Wilk

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.