ufs queue
From: Jeuk Kim <[email protected]>
The following changes since commit b9ee1387e0cf0fba5a73a610d31cb9cead457dc0:
Merge tag 'sdmmc-20240706' of https://github.com/philmd/qemu into staging (2024-07-07 10:34:52 -0700)
are available in the Git repository at:
https://gitlab.com/jeuk20.kim/qemu.git tags/pull-ufs-20240708
for you to fetch changes up to 6db492596dd9204e8fe341b2396472271cf15023:
hw/ufs: Fix mcq register range determination logic (2024-07-08 10:25:20 +0900)
----------------------------------------------------------------
hw/ufs:
- Fix invalid address access in ufs_is_mcq_reg()
----------------------------------------------------------------
Jeuk Kim (1):
hw/ufs: Fix mcq register range determination logic
hw/ufs/ufs.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
[PULL 1/1] hw/ufs: Fix mcq register range determination logic
From: Jeuk Kim <[email protected]>
The function ufs_is_mcq_reg() only evaluated the range of the mcq_op_reg offset, which is defined as a constant. Therefore, it was possible for ufs_is_mcq_reg() to return true despite ufs device is configured to not support the mcq. This could cause ufs_mmio_read()/ufs_mmio_write() to result in a segmentation fault due to accessing an invalid address. So fix it.
Message-Id: <6dcb63036f3b35c833de752d1472d08bf4a9c289.1719996804.git.jeuk20.kim@samsung.com>
--- hw/ufs/ufs.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
hw/ufs/ufs.c +7 -1
@@ -57,7 +57,13 @@ static inline uint64_t ufs_reg_size(UfsHc *u)static inline bool ufs_is_mcq_reg (UfsHc *u,uint64_t addr,unsigned size) { -uint64_t mcq_reg_addr =ufs_mcq_reg_addr (u,0 ); +uint64_t mcq_reg_addr; + +if (!u->params.mcq) { +return false; + } + + mcq_reg_addr =ufs_mcq_reg_addr (u,0 );return (addr >= mcq_reg_addr && addr + size <= mcq_reg_addr +sizeof (u->mcq_reg)); }
Signature · 1 line
2.34.1
I'm so sorry. I forgot to add something to the patch, I'll add it and resend it to you. Sorry again.
Quoted 24 lines · Jeuk Kim
From: Jeuk Kim <[email protected]>
The following changes since commit
b9ee1387e0cf0fba5a73a610d31cb9cead457dc0:Merge tag 'sdmmc-20240706' of https://github.com/philmd/qemu into staging (2024-07-07 10:34:52 -0700)are available in the Git repository at:
https://gitlab.com/jeuk20.kim/qemu.git tags/pull-ufs-20240708for you to fetch changes up to
6db492596dd9204e8fe341b2396472271cf15023:hw/ufs: Fix mcq register range determination logic (2024-07-08 10:25:20 +0900)
----------------------------------------------------------------
hw/ufs:
- Fix invalid address access inufs_is_mcq_reg()----------------------------------------------------------------
Jeuk Kim (1):
hw/ufs: Fix mcq register range determination logichw/ufs/ufs.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)