summaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorShuah Khan (Samsung OSG) <shuah@kernel.org>2018-05-14 20:49:58 -0600
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-05-15 09:52:02 +0200
commit22076557b07c12086eeb16b8ce2b0b735f7a27e7 (patch)
treec568062087d8f520520d13239f603fbdf2b45ce3 /drivers/media
parent7510df3f29d44685bab7b1918b61a8ccd57126a9 (diff)
downloadlinux-22076557b07c12086eeb16b8ce2b0b735f7a27e7.tar.gz
linux-22076557b07c12086eeb16b8ce2b0b735f7a27e7.tar.bz2
linux-22076557b07c12086eeb16b8ce2b0b735f7a27e7.zip
usbip: usbip_host: fix NULL-ptr deref and use-after-free errors
usbip_host updates device status without holding lock from stub probe, disconnect and rebind code paths. When multiple requests to import a device are received, these unprotected code paths step all over each other and drive fails with NULL-ptr deref and use-after-free errors. The driver uses a table lock to protect the busid array for adding and deleting busids to the table. However, the probe, disconnect and rebind paths get the busid table entry and update the status without holding the busid table lock. Add a new finer grain lock to protect the busid entry. This new lock will be held to search and update the busid entry fields from get_busid_idx(), add_match_busid() and del_match_busid(). match_busid_show() does the same to access the busid entry fields. get_busid_priv() changed to return the pointer to the busid entry holding the busid lock. stub_probe(), stub_disconnect() and stub_device_rebind() call put_busid_priv() to release the busid lock before returning. This changes fixes the unprotected code paths eliminating the race conditions in updating the busid entries. Reported-by: Jakub Jirasek Signed-off-by: Shuah Khan (Samsung OSG) <shuah@kernel.org> Cc: stable <stable@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/media')
0 files changed, 0 insertions, 0 deletions