• Johan Hovold's avatar
    USB: keyspan: fix NULL-pointer dereferences and memory leaks · f79b2d0f
    Johan Hovold authored
    Fix NULL-pointer dereference at release by moving port data allocation
    and deallocation to port_probe and port_remove.
    
    Fix NULL-pointer dereference at disconnect by stopping port urbs at
    port_remove.
    
    Since commit 0998d063 (device-core: Ensure drvdata = NULL when no
    driver is bound) the port private data is no longer accessible at
    disconnect or release.
    
    Note that this patch also fixes port and interface-data memory leaks in
    the error path of attach should port initialisation fail for any port.
    
    Compile-only tested.
    
    Cc: <stable@vger.kernel.org>
    Signed-off-by: default avatarJohan Hovold <jhovold@gmail.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    f79b2d0f
keyspan.c 66.3 KB