Commit b55a06df authored by liujunjie's avatar liujunjie Committed by Gerd Hoffmann
Browse files

ps2: check PS2Queue wptr pointer in post_load routine



In commit 802cbcb7, most issues have been fixed when qemu guest
migration. But the queue size still need to check whether is equal to
PS2_QUEUE_SIZE. If yes, the wptr should set as 0. Or, wptr would larger
than PS2_QUEUE_SIZE and never come back when ps2_queue_noirq is called.
This could lead to OOB access, add check to avoid it.

Signed-off-by: default avatarliujunjie <liujunjie23@huawei.com>
Reviewed-by: default avatarGonglei <arei.gonglei@huawei.com>
Message-id: 20180607080237.12360-1-liujunjie23@huawei.com
Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
parent 2ef2f167
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -927,7 +927,7 @@ static void ps2_common_post_load(PS2State *s)

    /* reset rptr/wptr/count */
    q->rptr = 0;
    q->wptr = size;
    q->wptr = (size == PS2_QUEUE_SIZE) ? 0 : size;
    q->count = size;
    s->update_irq(s->update_arg, q->count != 0);
}