• Christian Lamparter's avatar
    carl9170: fix misuse of device driver API · e178cbbc
    Christian Lamparter authored
    commit feb09b2933275a70917a869989ea2823e7356be8 upstream.
    
    This patch follows Alan Stern's recent patch:
    "p54: Fix race between disconnect and firmware loading"
    
    that overhauled carl9170 buggy firmware loading and driver
    unbinding procedures.
    
    Since the carl9170 code was adapted from p54 it uses the
    same functions and is likely to have the same problem, but
    it's just that the syzbot hasn't reproduce them (yet).
    
    a summary from the changes (copied from the p54 patch):
     * Call usb_driver_release_interface() rather than
       device_release_driver().
    
     * Lock udev (the interface's parent) before unbinding the
       driver instead of locking udev->parent.
    
     * During the firmware loading process, take a reference
       to the USB interface instead of the USB device.
    
     * Don't take an unnecessary reference to the device during
       probe (and then don't drop it during disconnect).
    
    and
    
     * Make sure to prevent use-after-free bugs by explicitly
       setting the driver context to NULL after signaling the
       completion.
    
    Cc: <stable@vger.kernel.org>
    Cc: Alan Stern <stern@rowland.harvard.edu>
    Signed-off-by: default avatarChristian Lamparter <chunkeey@gmail.com>
    Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
    Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    e178cbbc
Name
Last commit
Last update
Documentation Loading commit data...
arch Loading commit data...
block Loading commit data...
certs Loading commit data...
crypto Loading commit data...
drivers Loading commit data...
firmware Loading commit data...
fs Loading commit data...
include Loading commit data...
init Loading commit data...
ipc Loading commit data...
kernel Loading commit data...
lib Loading commit data...
mm Loading commit data...
net Loading commit data...
samples Loading commit data...
scripts Loading commit data...
security Loading commit data...
sound Loading commit data...
tools Loading commit data...
usr Loading commit data...
virt Loading commit data...
.cocciconfig Loading commit data...
.get_maintainer.ignore Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.mailmap Loading commit data...
COPYING Loading commit data...
CREDITS Loading commit data...
Kbuild Loading commit data...
Kconfig Loading commit data...
MAINTAINERS Loading commit data...
Makefile Loading commit data...
README Loading commit data...