• Alan Stern's avatar
    USB: g_file_storage: fix use-after-free bug when closing files · 82a10a81
    Alan Stern authored
    This patch (as1231) fixes a use-after-free bug in g_file_storage.  A
    device's name may not be available after the device is unregistered,
    even if the device structure itself is still allocated.  Since
    close_backing_file() prints a LUN's name for debugging, it shouldn't
    be called after the LUN has been unregistered.
    
    That whole area needed to be cleaned up; the backing files were
    getting closed in a couple of different places.  The patch fixes
    things so that they get closed in just one place, as part of the
    unbind procedure, immediately before the LUN is unregistered.
    Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
    82a10a81
file_storage.c 118 KB