summaryrefslogtreecommitdiff
path: root/net/9p/trans_xen.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-07-12 17:31:19 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2019-07-12 17:31:19 -0700
commit23bbbf5c1fb3ddf104c2ddbda4cc24ebe53a3453 (patch)
tree8a3c882dcddc89175efb93236b6f57036165eb88 /net/9p/trans_xen.c
parenta641a88e5d6864f20b2608cb01165c756794e645 (diff)
parent80a316ff16276b36d0392a8f8b2f63259857ae98 (diff)
Merge tag '9p-for-5.3' of git://github.com/martinetd/linux
Pull 9p updates from Dominique Martinet: "Two small fixes to properly cleanup the 9p transports list if virtio/xen module initialization fail. 9p might otherwise try to access memory from a module that failed to register got freed" * tag '9p-for-5.3' of git://github.com/martinetd/linux: 9p/xen: Add cleanup path in p9_trans_xen_init 9p/virtio: Add cleanup path in p9_virtio_init
Diffstat (limited to 'net/9p/trans_xen.c')
-rw-r--r--net/9p/trans_xen.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/net/9p/trans_xen.c b/net/9p/trans_xen.c
index 29420ebb8f07..3963eb11c3fb 100644
--- a/net/9p/trans_xen.c
+++ b/net/9p/trans_xen.c
@@ -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);