qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Re: [PATCH] virtio-serial: don't crash on invalid input


From: Amit Shah
Subject: [Qemu-devel] Re: [PATCH] virtio-serial: don't crash on invalid input
Date: Tue, 22 Mar 2011 22:25:06 +0530
User-agent: Mutt/1.5.21 (2010-09-15)

On (Tue) 22 Mar 2011 [18:32:50], Michael S. Tsirkin wrote:
> Fix crash on invalid input in virtio-serial.
> Discovered by code review, untested.
> 
> Signed-off-by: Michael S. Tsirkin <address@hidden>
> ---
>  hw/virtio-serial-bus.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c
> index e0bf6c5..8807a2f 100644
> --- a/hw/virtio-serial-bus.c
> +++ b/hw/virtio-serial-bus.c
> @@ -654,6 +654,9 @@ static int virtio_serial_load(QEMUFile *f, void *opaque, 
> int version_id)
>  
>          id = qemu_get_be32(f);
>          port = find_port_by_id(s, id);
> +        if (!port) {
> +            return -EINVAL;
> +        }

Just before this, we matched the ports_map which would bail out if the
corresponding port isn't avl. in the destination, so this check is
made redundant.

                Amit



reply via email to

[Prev in Thread] Current Thread [Next in Thread]