aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorLaszlo Ersek <lersek@redhat.com>2011-10-07 15:34:38 -0400
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2011-10-13 09:48:35 -0400
commit469738e675524b6aa029ecd46bdda3f878b12eff (patch)
tree3eb7ba048443b12adebebff8b76d9b60633c4f49 /drivers/block
parentd11e6158307bed3f178399a4e6216eec67d16200 (diff)
xen-blkfront: plug device number leak in xlblk_init() error path
... though after a failed xenbus_register_frontend() all may be lost. Acked-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/xen-blkfront.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index 8bf0cb7b2565..773da7d6491e 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -1450,6 +1450,8 @@ static struct xenbus_driver blkfront = {
1450 1450
1451static int __init xlblk_init(void) 1451static int __init xlblk_init(void)
1452{ 1452{
1453 int ret;
1454
1453 if (!xen_domain()) 1455 if (!xen_domain())
1454 return -ENODEV; 1456 return -ENODEV;
1455 1457
@@ -1459,7 +1461,13 @@ static int __init xlblk_init(void)
1459 return -ENODEV; 1461 return -ENODEV;
1460 } 1462 }
1461 1463
1462 return xenbus_register_frontend(&blkfront); 1464 ret = xenbus_register_frontend(&blkfront);
1465 if (ret) {
1466 unregister_blkdev(XENVBD_MAJOR, DEV_NAME);
1467 return ret;
1468 }
1469
1470 return 0;
1463} 1471}
1464module_init(xlblk_init); 1472module_init(xlblk_init);
1465 1473