summaryrefslogtreecommitdiffstats
path: root/net/9p/trans_virtio.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-07-13 02:31:19 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2019-07-13 02:31:19 +0200
commit23bbbf5c1fb3ddf104c2ddbda4cc24ebe53a3453 (patch)
tree8a3c882dcddc89175efb93236b6f57036165eb88 /net/9p/trans_virtio.c
parentMerge tag 'f2fs-for-5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/jae... (diff)
parent9p/xen: Add cleanup path in p9_trans_xen_init (diff)
downloadlinux-23bbbf5c1fb3ddf104c2ddbda4cc24ebe53a3453.tar.xz
linux-23bbbf5c1fb3ddf104c2ddbda4cc24ebe53a3453.zip
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_virtio.c')
-rw-r--r--net/9p/trans_virtio.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c
index 549938af02e7..a3cd90a74012 100644
--- a/net/9p/trans_virtio.c
+++ b/net/9p/trans_virtio.c
@@ -767,10 +767,16 @@ static struct p9_trans_module p9_virtio_trans = {
/* The standard init function */
static int __init p9_virtio_init(void)
{
+ int rc;
+
INIT_LIST_HEAD(&virtio_chan_list);
v9fs_register_trans(&p9_virtio_trans);
- return register_virtio_driver(&p9_virtio_drv);
+ rc = register_virtio_driver(&p9_virtio_drv);
+ if (rc)
+ v9fs_unregister_trans(&p9_virtio_trans);
+
+ return rc;
}
static void __exit p9_virtio_cleanup(void)