• Greg Kroah-Hartman's avatar
    usb: misc: legousbtower: Fix NULL pointer deference · 03f8e90d
    Greg Kroah-Hartman authored
    commit 2fae9e5a upstream.
    
    This patch fixes a NULL pointer dereference caused by a race codition in
    the probe function of the legousbtower driver. It re-structures the
    probe function to only register the interface after successfully reading
    the board's firmware ID.
    
    The probe function does not deregister the usb interface after an error
    receiving the devices firmware ID. The device file registered
    (/dev/usb/legousbtower%d) may be read/written globally before the probe
    function returns. When tower_delete is called in the probe function
    (after an r/w has been initiated), core dev structures are deleted while
    the file operation functions are still running. If the 0 address is
    mappable on the machine, this vulnerability can be used to create a
    Local Priviege Escalation exploit via a write-what-where condition by
    remapping dev->interrupt_out_buffer in tower_write. A forged USB device
    and local program execution would be required for LPE. The USB device
    would have to delay the control message in tower_probe and accept
    the control urb in tower_open whilst guest code initiated a write to the
    device file as tower_delete is called from the error in tower_probe.
    
    This bug has existed since 2003. Patch tested by emulated device.
    Reported-by: default avatarJames Patrick-Evans <james@jmp-e.com>
    Tested-by: default avatarJames Patrick-Evans <james@jmp-e.com>
    Signed-off-by: default avatarJames Patrick-Evans <james@jmp-e.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    03f8e90d
legousbtower.c 27.1 KB