linux-stable/drivers/usb/roles
Hans de Goede 3a2a91a2d5 usb: roles: Call try_module_get() from usb_role_switch_find_by_fwnode()
usb_role_switch_find_by_fwnode() returns a reference to the role-switch
which must be put by calling usb_role_switch_put().

usb_role_switch_put() calls module_put(sw->dev.parent->driver->owner),
add a matching try_module_get() to usb_role_switch_find_by_fwnode(),
making it behave the same as the other usb_role_switch functions
which return a reference.

This avoids a WARN_ON being hit at kernel/module.c:1158 due to the
module-refcount going below 0.

Fixes: c6919d5e0c ("usb: roles: Add usb_role_switch_find_by_fwnode()")
Cc: stable <stable@vger.kernel.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20210409124136.65591-1-hdegoede@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-04-09 16:07:03 +02:00
..
class.c usb: roles: Call try_module_get() from usb_role_switch_find_by_fwnode() 2021-04-09 16:07:03 +02:00
intel-xhci-usb-role-switch.c usb: roles: Provide the switch drivers handle to the switch in the API 2020-03-04 11:12:50 +01:00
Kconfig USB: add missing SPDX lines to Kconfig and Makefiles 2019-01-22 09:08:17 +01:00
Makefile USB: add missing SPDX lines to Kconfig and Makefiles 2019-01-22 09:08:17 +01:00