]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
mtd: onenand: Fix uninitialized retlen in do_otp_read()
authorIvan Stepchenko <sid@itb.spb.ru>
Thu, 14 Nov 2024 13:29:51 +0000 (16:29 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Feb 2025 12:49:51 +0000 (13:49 +0100)
commite56db83b32cd690634ecb48daf56e84ba61d3307
tree75671858884de7d3d9ea57df93da59734b726cee
parent2e432c894863a80e2344b334b792c8ac6a7eb4d2
mtd: onenand: Fix uninitialized retlen in do_otp_read()

commit 70a71f8151b9879b0950668ce3ad76263261fee0 upstream.

The function do_otp_read() does not set the output parameter *retlen,
which is expected to contain the number of bytes actually read.
As a result, in onenand_otp_walk(), the tmp_retlen variable remains
uninitialized after calling do_otp_walk() and used to change
the values of the buf, len and retlen variables.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 49dc08eeda70 ("[MTD] [OneNAND] fix numerous races")
Cc: stable@vger.kernel.org
Signed-off-by: Ivan Stepchenko <sid@itb.spb.ru>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/mtd/nand/onenand/onenand_base.c