]> git.ipfire.org Git - thirdparty/qemu.git/commit
hw/sd: fix out-of-bounds check for multi block reads
authorMichael Olbrich <m.olbrich@pengutronix.de>
Fri, 6 Oct 2017 15:46:47 +0000 (16:46 +0100)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Wed, 6 Dec 2017 01:39:35 +0000 (19:39 -0600)
commit64f62e4e901e268696234e13357d7b978ad29f1e
tree0c500139877cd4d65ff1aad44f4c852256190b4b
parentd765c5e5779fe25f8dcb7f65c9a27a7b5a77941f
hw/sd: fix out-of-bounds check for multi block reads

The current code checks if the next block exceeds the size of the card.
This generates an error while reading the last block of the card.
Do the out-of-bounds check when starting to read a new block to fix this.

This issue became visible with increased error checking in Linux 4.13.

Cc: qemu-stable@nongnu.org
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>
Message-id: 20170916091611.10241-1-m.olbrich@pengutronix.de
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit 8573378e62d19e25a2434e23462ec99ef4d065ac)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
hw/sd/sd.c