]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
usb: dwc3: gadget: Prevent core from processing stale TRBs
authorUdipto Goswami <quic_ugoswami@quicinc.com>
Mon, 7 Feb 2022 04:25:58 +0000 (09:55 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Feb 2022 11:44:52 +0000 (12:44 +0100)
commit0d18cda400d506e01c9c8108447c6ceddc0288f7
tree8ba1aa1a65a8c3d4fd776e0fefb61e794e8212b2
parent67375f607e16b82b8a810b4f47bf545796958348
usb: dwc3: gadget: Prevent core from processing stale TRBs

commit 117b4e96c7f362eb6459543883fc07f77662472c upstream.

With CPU re-ordering on write instructions, there might
be a chance that the HWO is set before the TRB is updated
with the new mapped buffer address.
And in the case where core is processing a list of TRBs
it is possible that it fetched the TRBs when the HWO is set
but before the buffer address is updated.
Prevent this by adding a memory barrier before the HWO
is updated to ensure that the core always process the
updated TRBs.

Fixes: f6bafc6a1c9d ("usb: dwc3: convert TRBs into bitshifts")
Cc: stable <stable@vger.kernel.org>
Reviewed-by: Pavankumar Kondeti <quic_pkondeti@quicinc.com>
Signed-off-by: Udipto Goswami <quic_ugoswami@quicinc.com>
Link: https://lore.kernel.org/r/1644207958-18287-1-git-send-email-quic_ugoswami@quicinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/dwc3/gadget.c