Skip to content
Commit 69b27dbe authored by Pavankumar Kondeti's avatar Pavankumar Kondeti Committed by Yuan Can
Browse files

xhci: Fix command ring pointer corruption while aborting a command

stable inclusion
from stable-v4.19.213
commit 62c182b5e763e5f4062e72678e72ce3e02dd4d1b
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/I9RB55
CVE: CVE-2021-47434

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=62c182b5e763e5f4062e72678e72ce3e02dd4d1b



--------------------------------

commit ff0e50d3 upstream.

The command ring pointer is located at [6:63] bits of the command
ring control register (CRCR). All the control bits like command stop,
abort are located at [0:3] bits. While aborting a command, we read the
CRCR and set the abort bit and write to the CRCR. The read will always
give command ring pointer as all zeros. So we essentially write only
the control bits. Since we split the 64 bit write into two 32 bit writes,
there is a possibility of xHC command ring stopped before the upper
dword (all zeros) is written. If that happens, xHC updates the upper
dword of its internal command ring pointer with all zeros. Next time,
when the command ring is restarted, we see xHC memory access failures.
Fix this issue by only writing to the lower dword of CRCR where all
control bits are located.

Cc: stable@vger.kernel.org
Signed-off-by: default avatarPavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/20211008092547.3996295-5-mathias.nyman@linux.intel.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarYuan Can <yuancan@huawei.com>
parent 2acc543f
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment