提交 1253882d 编写于 作者: Y YueHaibing 提交者: Greg Kroah-Hartman

9p/xen: Add cleanup path in p9_trans_xen_init

commit 80a316ff16276b36d0392a8f8b2f63259857ae98 upstream.

If xenbus_register_frontend() fails in p9_trans_xen_init,
we should call v9fs_unregister_trans() to do cleanup.

Link: http://lkml.kernel.org/r/20190430143933.19368-1-yuehaibing@huawei.com
Cc: stable@vger.kernel.org
Fixes: 868eb122 ("xen/9pfs: introduce Xen 9pfs transport driver")
Signed-off-by: NYueHaibing <yuehaibing@huawei.com>
Signed-off-by: NDominique Martinet <dominique.martinet@cea.fr>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 007e5aaf
......@@ -530,13 +530,19 @@ static struct xenbus_driver xen_9pfs_front_driver = {
static int p9_trans_xen_init(void)
{
int rc;
if (!xen_domain())
return -ENODEV;
pr_info("Initialising Xen transport for 9pfs\n");
v9fs_register_trans(&p9_xen_trans);
return xenbus_register_frontend(&xen_9pfs_front_driver);
rc = xenbus_register_frontend(&xen_9pfs_front_driver);
if (rc)
v9fs_unregister_trans(&p9_xen_trans);
return rc;
}
module_init(p9_trans_xen_init);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册