File kvm-qemu-preXX-virtio-serial-don-t-crash-on-invalid-input.patch of Package kvm.853

From fbe0c5591077814eead05217fc96f087b254a6a8 Mon Sep 17 00:00:00 2001
From: Michael S. Tsirkin <mst@redhat.com>
Date: Tue, 22 Mar 2011 18:32:50 +0200
Subject: [PATCH] virtio-serial: don't crash on invalid input

Fix crash on invalid input in virtio-serial.
Discovered by code review, untested.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/virtio-serial-bus.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

Index: qemu-kvm-0.14.0/hw/virtio-serial-bus.c
===================================================================
--- qemu-kvm-0.14.0.orig/hw/virtio-serial-bus.c
+++ qemu-kvm-0.14.0/hw/virtio-serial-bus.c
@@ -600,6 +600,9 @@ static int virtio_serial_load(QEMUFile *
 
         id = qemu_get_be32(f);
         port = find_port_by_id(s, id);
+        if (!port) {
+            return -EINVAL;
+        }
 
         port->guest_connected = qemu_get_byte(f);
         host_connected = qemu_get_byte(f);