summaryrefslogtreecommitdiffstats
path: root/drivers/misc/cardreader/rtsx_pcr.c
diff options
context:
space:
mode:
authorRalph Siemsen <ralph.siemsen@linaro.org>2021-11-08 13:16:27 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-12-03 14:19:54 +0100
commit9a626577398c24ecab63c0a684436c8928092367 (patch)
tree21b9bd1012ab3637f6d1f4ae3cb7603c662665ba /drivers/misc/cardreader/rtsx_pcr.c
parent3a1bf591e9a410f220b7405a142a47407394a1d5 (diff)
downloadlinux-9a626577398c24ecab63c0a684436c8928092367.tar.bz2
nvmem: eeprom: at25: fix FRAM byte_len
Commit fd307a4ad332 ("nvmem: prepare basics for FRAM support") added support for FRAM devices such as the Cypress FM25V. During testing, it was found that the FRAM detects properly, however reads and writes fail. Upon further investigation, two problem were found in at25_probe() routine. 1) In the case of an FRAM device without platform data, eg. fram == true && spi->dev.platform_data == NULL the stack local variable "struct spi_eeprom chip" is not initialized fully, prior to being copied into at25->chip. The chip.flags field in particular can cause problems. 2) The byte_len of FRAM is computed from its ID register, and is stored into the stack local "struct spi_eeprom chip" structure. This happens after the same structure has been copied into at25->chip. As a result, at25->chip.byte_len does not contain the correct length of the device. In turn this can cause checks at beginning of at25_ee_read() to fail (or equally, it could allow reads beyond the end of the device length). Fix both of these issues by eliminating the on-stack struct spi_eeprom. Instead use the one inside at25_data structure, which starts of zeroed. Fixes: fd307a4ad332 ("nvmem: prepare basics for FRAM support") Cc: stable <stable@vger.kernel.org> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Ralph Siemsen <ralph.siemsen@linaro.org> Link: https://lore.kernel.org/r/20211108181627.645638-1-ralph.siemsen@linaro.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/cardreader/rtsx_pcr.c')
0 files changed, 0 insertions, 0 deletions