Commit 469738e6 authored by Laszlo Ersek's avatar Laszlo Ersek Committed by Konrad Rzeszutek Wilk

xen-blkfront: plug device number leak in xlblk_init() error path

... though after a failed xenbus_register_frontend() all may be lost.
Acked-by: default avatarIan Campbell <ian.campbell@citrix.com>
Signed-off-by: default avatarLaszlo Ersek <lersek@redhat.com>
Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
parent d11e6158
......@@ -1450,6 +1450,8 @@ static struct xenbus_driver blkfront = {
static int __init xlblk_init(void)
{
int ret;
if (!xen_domain())
return -ENODEV;
......@@ -1459,7 +1461,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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment