]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
usb: mtu3: add memory barrier before set GPD's HWO
authorChunfeng Yun <chunfeng.yun@mediatek.com>
Sat, 18 Dec 2021 09:57:47 +0000 (17:57 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 5 Jan 2022 11:37:45 +0000 (12:37 +0100)
commit50434eb6098fec04eba6c8fc20457fb636deff8c
tree87195505e5c5ead6a775b84c692acf5529268249
parent240fc586e83d645912accce081a48aa63a45f6ee
usb: mtu3: add memory barrier before set GPD's HWO

commit a7aae769ca626819a7f9f078ebdc69a8a1b00c81 upstream.

There is a seldom issue that the controller access invalid address
and trigger devapc or emimpu violation. That is due to memory access
is out of order and cause gpd data is not correct.
Add mb() to prohibit compiler or cpu from reordering to make sure GPD
is fully written before setting its HWO.

Fixes: 48e0d3735aa5 ("usb: mtu3: supports new QMU format")
Cc: stable@vger.kernel.org
Reported-by: Eddie Hung <eddie.hung@mediatek.com>
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Link: https://lore.kernel.org/r/20211218095749.6250-2-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/mtu3/mtu3_qmu.c