Skip to content

Commit

Permalink
9p/xen: Add cleanup path in p9_trans_xen_init
Browse files Browse the repository at this point in the history
commit 80a316f 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: 868eb12 ("xen/9pfs: introduce Xen 9pfs transport driver")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Dominique Martinet <dominique.martinet@cea.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
YueHaibing authored and gregkh committed Jul 26, 2019
1 parent 007e5aa commit 1253882
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion net/9p/trans_xen.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 1253882

Please sign in to comment.