Commit fcf5787c authored by Peter Maydell's avatar Peter Maydell
Browse files

hw/block/onenand: Fix off-by-one error allowing out-of-bounds read



An off-by-one error in a switch case in onenand_read() allowed
a misbehaving guest to read off the end of a block of memory.

NB: the onenand device is used only by the "n800" and "n810"
machines, which are usable only with TCG, not KVM, so this is
not a security issue.

Reported-by: default avatarThomas Huth <thuth@redhat.com>
Reviewed-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: default avatarRichard Henderson <richard.henderson@linaro.org>
Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
Message-id: 20181115143535.5885-2-peter.maydell@linaro.org
Suggested-by: default avatarRichard Henderson <richard.henderson@linaro.org>
Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
parent 7760da72
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -608,7 +608,7 @@ static uint64_t onenand_read(void *opaque, hwaddr addr,
    int offset = addr >> s->shift;

    switch (offset) {
    case 0x0000 ... 0xc000:
    case 0x0000 ... 0xbffe:
        return lduw_le_p(s->boot[0] + addr);

    case 0xf000:	/* Manufacturer ID */