mmc: fix eMMC v5.1 incorrect version detection
PATCH 1/1 mmc: fix eMMC v5.1 incorrect version detection
eMMC cards v5.1 has value 8 inside EXT_CSD_REV register. The patch make EXT_CSD_REV value 8 match v5.1
The is a hole inside version enumeration. EXT_CSD_REV value 4 doens't correspond to any valid eMMC version. So EXT_CSD_REV value 4 assigned undefined version.
Also the patch fix mmc_versions array bounds check. Value 8 produced out of array access.
--- drivers/mmc/mmc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mmc/mmc.c +3 -1
@@ -1950,6 +1950,7 @@ static int mmc_startup_v4(struct mmc *mmc)MMC_VERSION_4_1 ,MMC_VERSION_4_2 ,MMC_VERSION_4_3 , +MMC_VERSION_UNKNOWN ,MMC_VERSION_4_41 ,MMC_VERSION_4_5 , MMC_VERSION_5_0,
@@ -1973,7 +1974,8 @@ static int mmc_startup_v4(struct mmc *mmc)return -ENOMEM ;memcpy (mmc->ext_csd, ext_csd,MMC_MAX_BLOCK_LEN ); -if (ext_csd[EXT_CSD_REV ] >ARRAY_SIZE (mmc_versions)) +if (ext_csd[EXT_CSD_REV ] >=ARRAY_SIZE (mmc_versions) || + ext_csd[EXT_CSD_REV ] ==4 )return -EINVAL ; mmc->version = mmc_versions[ext_csd[EXT_CSD_REV ]];
Signature · 1 line
1.7.9.5
PATCH 1/1 mmc: fix eMMC v5.1 incorrect version detection
Hi,
Quoted 9 lines · Alexander Kochetkov
eMMC cards v5.1 has value 8 inside
EXT_CSD_REVregister. The patch makeEXT_CSD_REVvalue 8 match v5.1The is a hole inside version enumeration.
EXT_CSD_REVvalue 4 doens't correspond to any valid eMMC version. SoEXT_CSD_REVvalue 4 assigned undefined version.Also the patch fix
mmc_versionsarray bounds check. Value 8 produced out of array access.
It was already fixed.
http://git.denx.de/?p=u-boot/u-boot-mmc.git;a=commit;h=ace1bed327411cf3cade45599864df2d461045a0
Best Regards,
Jaehoon Chung
Quoted 29 lines
Signed-off-by Alexander Kochetkov <[email protected]>--- drivers/mmc/mmc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/mmc/mmc.c +3
-1@@ -1950,6 +1950,7 @@ static int mmc_startup_v4(struct mmc *mmc)MMC_VERSION_4_1 ,MMC_VERSION_4_2 ,MMC_VERSION_4_3 , +MMC_VERSION_UNKNOWN ,MMC_VERSION_4_41 ,MMC_VERSION_4_5 , MMC_VERSION_5_0,@@ -1973,7 +1974,8 @@ static int mmc_startup_v4(struct mmc *mmc)return -ENOMEM ;memcpy (mmc->ext_csd, ext_csd,MMC_MAX_BLOCK_LEN ); -if (ext_csd[EXT_CSD_REV ] >ARRAY_SIZE (mmc_versions)) +if (ext_csd[EXT_CSD_REV ] >=ARRAY_SIZE (mmc_versions) || + ext_csd[EXT_CSD_REV ] ==4 )return -EINVAL ; mmc->version = mmc_versions[ext_csd[EXT_CSD_REV ]];
PATCH 1/1 mmc: fix eMMC v5.1 incorrect version detection
Quoted 6 lines
20 февр. 2018 г., в 13:02, Jaehoon Chung <[email protected]> написал(а):
Quoted 2 lines
Also the patch fix
mmc_versionsarray bounds check. Value 8 produced out of array access.
Quoted 6 lines
It was already fixed.
http://git.denx.de/?p=u-boot/u-boot-mmc.git;a=commit;h=ace1bed327411cf3cade45599864df2d461045a0
Best Regards,
Jaehoon Chung
Thank you for pointing updated git tree.
I sent off-by-one bug fix from the patch as new patch.
Regards,
Alexander.