~bdrung/qemu-kvm/caps-lock-key-up-event

« back to all changes in this revision

Viewing changes to debian/patches/check-for-invalid-initrd-file.patch

  • Committer: Bazaar Package Importer
  • Author(s): Serge Hallyn
  • Date: 2010-08-30 12:49:47 UTC
  • Revision ID: james.westby@ubuntu.com-20100830124947-jstnfpuk27ejmoz0
Tags: 0.12.5+noroms-0ubuntu5
Apply patch to fix the lack of error checking when opening
an initrd file.  (LP: #619302)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
commit d6fa4b77fb8f27ac84cf23fb1e15016673d98a47
 
2
Author: M. Mohan Kumar <mohan@in.ibm.com>
 
3
Date:   Mon Apr 12 10:01:33 2010 +0530
 
4
 
 
5
    Check for invalid initrd file
 
6
    
 
7
    When qemu is invoked with an invalid initrd file, it crashes. Following
 
8
    patch prints a error message and exits if an invalid initrd is
 
9
    specified. Includes changes suggested by JV.
 
10
    
 
11
    Signed-off-by: M. Mohan Kumar <mohan@in.ibm.com>
 
12
    Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
 
13
 
 
14
Index: qemu-kvm-0.12.3+noroms/hw/pc.c
 
15
===================================================================
 
16
--- qemu-kvm-0.12.3+noroms.orig/hw/pc.c 2010-08-31 03:11:42.000000000 +1200
 
17
+++ qemu-kvm-0.12.3+noroms/hw/pc.c      2010-08-31 03:13:59.000000000 +1200
 
18
@@ -871,6 +871,12 @@
 
19
        }
 
20
 
 
21
        initrd_size = get_image_size(initrd_filename);
 
22
+        if (initrd_size < 0) {
 
23
+            fprintf(stderr, "qemu: error reading initrd %s\n",
 
24
+                    initrd_filename);
 
25
+            exit(1);
 
26
+        }
 
27
+
 
28
         initrd_addr = (initrd_max-initrd_size) & ~4095;
 
29
 
 
30
         initrd_data = qemu_malloc(initrd_size);