Commit 23bbbf5c authored by Linus Torvalds's avatar Linus Torvalds
Browse files

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
parents a641a88e 80a316ff
Loading
Loading
Loading
Loading
+7 −1
Original line number Original line Diff line number Diff line
@@ -767,10 +767,16 @@ static struct p9_trans_module p9_virtio_trans = {
/* The standard init function */
/* The standard init function */
static int __init p9_virtio_init(void)
static int __init p9_virtio_init(void)
{
{
	int rc;

	INIT_LIST_HEAD(&virtio_chan_list);
	INIT_LIST_HEAD(&virtio_chan_list);


	v9fs_register_trans(&p9_virtio_trans);
	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)
static void __exit p9_virtio_cleanup(void)
+7 −1
Original line number Original line Diff line number Diff line
@@ -530,13 +530,19 @@ static struct xenbus_driver xen_9pfs_front_driver = {


static int p9_trans_xen_init(void)
static int p9_trans_xen_init(void)
{
{
	int rc;

	if (!xen_domain())
	if (!xen_domain())
		return -ENODEV;
		return -ENODEV;


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


	v9fs_register_trans(&p9_xen_trans);
	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);
module_init(p9_trans_xen_init);