]> git.baikalelectronics.ru Git - kernel.git/commit
usb: musb: fix crash with highmen PIO and usbmon
authorMans Rullgard <mans@mansr.com>
Mon, 16 Mar 2020 21:11:35 +0000 (16:11 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 1 Apr 2020 09:02:15 +0000 (11:02 +0200)
commit1338ba300e13abc74c03b1ab82327a5409630d3a
tree324e4347cee8ea092a6342a165e396c5202cd0c5
parent2280d01fc296167c472f51bc8d7f6e7c1f8cf193
usb: musb: fix crash with highmen PIO and usbmon

commit 94c5a93ffb665448eb2a7ffe38d43314e7bb34b0 upstream.

When handling a PIO bulk transfer with highmem buffer, a temporary
mapping is assigned to urb->transfer_buffer.  After the transfer is
complete, an invalid address is left behind in this pointer.  This is
not ordinarily a problem since nothing touches that buffer before the
urb is released.  However, when usbmon is active, usbmon_urb_complete()
calls (indirectly) mon_bin_get_data() which does access the transfer
buffer if it is set.  To prevent an invalid memory access here, reset
urb->transfer_buffer to NULL when finished (musb_host_rx()), or do not
set it at all (musb_host_tx()).

Fixes: 66d5ba8d3614 ("usb: musb: host: Handle highmem in PIO mode")
Signed-off-by: Mans Rullgard <mans@mansr.com>
Cc: stable@vger.kernel.org
Signed-off-by: Bin Liu <b-liu@ti.com>
Link: https://lore.kernel.org/r/20200316211136.2274-8-b-liu@ti.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/musb/musb_host.c