Skip to content

Commit 80a316f

Browse files
YueHaibingDominique Martinet
authored andcommitted
9p/xen: Add cleanup path in p9_trans_xen_init
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: 868eb12 ("xen/9pfs: introduce Xen 9pfs transport driver") Signed-off-by: YueHaibing <yuehaibing@huawei.com> Signed-off-by: Dominique Martinet <dominique.martinet@cea.fr>
1 parent d454854 commit 80a316f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

net/9p/trans_xen.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,13 +530,19 @@ static struct xenbus_driver xen_9pfs_front_driver = {
530530

531531
static int p9_trans_xen_init(void)
532532
{
533+
int rc;
534+
533535
if (!xen_domain())
534536
return -ENODEV;
535537

536538
pr_info("Initialising Xen transport for 9pfs\n");
537539

538540
v9fs_register_trans(&p9_xen_trans);
539-
return xenbus_register_frontend(&xen_9pfs_front_driver);
541+
rc = xenbus_register_frontend(&xen_9pfs_front_driver);
542+
if (rc)
543+
v9fs_unregister_trans(&p9_xen_trans);
544+
545+
return rc;
540546
}
541547
module_init(p9_trans_xen_init);
542548

0 commit comments

Comments
 (0)