Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit eeb6a6ff authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman
Browse files

greybus: interface: fix potential use-after-free at remove



Fix resources (accessible through sysfs) being released before interface
is deregistered.

Signed-off-by: default avatarJohan Hovold <johan@hovoldconsulting.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent f865734d
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -60,6 +60,9 @@ static void gb_interface_release(struct device *dev)
{
	struct gb_interface *intf = to_gb_interface(dev);

	kfree(intf->product_string);
	kfree(intf->vendor_string);

	kfree(intf);
}

@@ -191,9 +194,6 @@ void gb_interface_remove(struct gb_interface *intf)
	list_for_each_entry_safe(bundle, next, &intf->bundles, links)
		gb_bundle_destroy(bundle);

	kfree(intf->product_string);
	kfree(intf->vendor_string);

	module = intf->module;
	device_unregister(&intf->dev);
	put_device(&module->dev);