qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] bootdevice: fix segment fault when booting guest with '-kernel' and '-initrd'
@ 2015-02-27  1:49 arei.gonglei
  2015-02-27 14:15 ` Paolo Bonzini
  0 siblings, 1 reply; 3+ messages in thread
From: arei.gonglei @ 2015-02-27  1:49 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, Gonglei, peter.huangpeng, edivaldoapereira

From: Gonglei <arei.gonglei@huawei.com>

Reproducer:

 $./qemu-system-x86_64 --enable-kvm -kernel /home/vmlinuz-2.6.32.12-0.7-default \
  -initrd /home/initrd-2.6.32.12-0.7-default -append \
 "root=/dev/ram rw console=ttyS0,115200" -dtb guest.dtb -vnc :10 --monitor stdio -smp 2
QEMU 2.2.50 monitor - type 'help' for more information
(qemu) Segmentation fault (core dumped)

Reported-by: Edivaldo de Araujo Pereira <edivaldoapereira@yahoo.com.br>
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
---
 bootdevice.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/bootdevice.c b/bootdevice.c
index df9ab0e..673bfef 100644
--- a/bootdevice.c
+++ b/bootdevice.c
@@ -223,10 +223,15 @@ char *get_boot_devices_list(size_t *size, bool ignore_suffixes)
         }
 
         if (!ignore_suffixes) {
-            d = qdev_get_own_fw_dev_path_from_handler(i->dev->parent_bus, i->dev);
-            if (d) {
-                assert(!i->suffix);
-                suffix = d;
+            if (i->dev) {
+                d = qdev_get_own_fw_dev_path_from_handler(i->dev->parent_bus,
+                                                          i->dev);
+                if (d) {
+                    assert(!i->suffix);
+                    suffix = d;
+                } else {
+                    suffix = g_strdup(i->suffix);
+                }
             } else {
                 suffix = g_strdup(i->suffix);
             }
-- 
1.7.12.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] bootdevice: fix segment fault when booting guest with '-kernel' and '-initrd'
  2015-02-27  1:49 [Qemu-devel] [PATCH] bootdevice: fix segment fault when booting guest with '-kernel' and '-initrd' arei.gonglei
@ 2015-02-27 14:15 ` Paolo Bonzini
  2015-02-28  1:06   ` Gonglei
  0 siblings, 1 reply; 3+ messages in thread
From: Paolo Bonzini @ 2015-02-27 14:15 UTC (permalink / raw)
  To: arei.gonglei, qemu-devel; +Cc: peter.huangpeng, edivaldoapereira

Looks good, I am applying it locally so that it can get into qemu.git
very soon.

Paolo

On 27/02/2015 02:49, arei.gonglei@huawei.com wrote:
> From: Gonglei <arei.gonglei@huawei.com>
> 
> Reproducer:
> 
>  $./qemu-system-x86_64 --enable-kvm -kernel /home/vmlinuz-2.6.32.12-0.7-default \
>   -initrd /home/initrd-2.6.32.12-0.7-default -append \
>  "root=/dev/ram rw console=ttyS0,115200" -dtb guest.dtb -vnc :10 --monitor stdio -smp 2
> QEMU 2.2.50 monitor - type 'help' for more information
> (qemu) Segmentation fault (core dumped)
> 
> Reported-by: Edivaldo de Araujo Pereira <edivaldoapereira@yahoo.com.br>
> Signed-off-by: Gonglei <arei.gonglei@huawei.com>
> ---
>  bootdevice.c | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/bootdevice.c b/bootdevice.c
> index df9ab0e..673bfef 100644
> --- a/bootdevice.c
> +++ b/bootdevice.c
> @@ -223,10 +223,15 @@ char *get_boot_devices_list(size_t *size, bool ignore_suffixes)
>          }
>  
>          if (!ignore_suffixes) {
> -            d = qdev_get_own_fw_dev_path_from_handler(i->dev->parent_bus, i->dev);
> -            if (d) {
> -                assert(!i->suffix);
> -                suffix = d;
> +            if (i->dev) {
> +                d = qdev_get_own_fw_dev_path_from_handler(i->dev->parent_bus,
> +                                                          i->dev);
> +                if (d) {
> +                    assert(!i->suffix);
> +                    suffix = d;
> +                } else {
> +                    suffix = g_strdup(i->suffix);
> +                }
>              } else {
>                  suffix = g_strdup(i->suffix);
>              }
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] bootdevice: fix segment fault when booting guest with '-kernel' and '-initrd'
  2015-02-27 14:15 ` Paolo Bonzini
@ 2015-02-28  1:06   ` Gonglei
  0 siblings, 0 replies; 3+ messages in thread
From: Gonglei @ 2015-02-28  1:06 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: peter.huangpeng, edivaldoapereira

On 2015/2/27 22:15, Paolo Bonzini wrote:
> Looks good, I am applying it locally so that it can get into qemu.git
> very soon.
> 
OK, thanks.

Regards,
-Gonglei
> Paolo
> 
> On 27/02/2015 02:49, arei.gonglei@huawei.com wrote:
>> From: Gonglei <arei.gonglei@huawei.com>
>>
>> Reproducer:
>>
>>  $./qemu-system-x86_64 --enable-kvm -kernel /home/vmlinuz-2.6.32.12-0.7-default \
>>   -initrd /home/initrd-2.6.32.12-0.7-default -append \
>>  "root=/dev/ram rw console=ttyS0,115200" -dtb guest.dtb -vnc :10 --monitor stdio -smp 2
>> QEMU 2.2.50 monitor - type 'help' for more information
>> (qemu) Segmentation fault (core dumped)
>>
>> Reported-by: Edivaldo de Araujo Pereira <edivaldoapereira@yahoo.com.br>
>> Signed-off-by: Gonglei <arei.gonglei@huawei.com>
>> ---
>>  bootdevice.c | 13 +++++++++----
>>  1 file changed, 9 insertions(+), 4 deletions(-)
>>
>> diff --git a/bootdevice.c b/bootdevice.c
>> index df9ab0e..673bfef 100644
>> --- a/bootdevice.c
>> +++ b/bootdevice.c
>> @@ -223,10 +223,15 @@ char *get_boot_devices_list(size_t *size, bool ignore_suffixes)
>>          }
>>  
>>          if (!ignore_suffixes) {
>> -            d = qdev_get_own_fw_dev_path_from_handler(i->dev->parent_bus, i->dev);
>> -            if (d) {
>> -                assert(!i->suffix);
>> -                suffix = d;
>> +            if (i->dev) {
>> +                d = qdev_get_own_fw_dev_path_from_handler(i->dev->parent_bus,
>> +                                                          i->dev);
>> +                if (d) {
>> +                    assert(!i->suffix);
>> +                    suffix = d;
>> +                } else {
>> +                    suffix = g_strdup(i->suffix);
>> +                }
>>              } else {
>>                  suffix = g_strdup(i->suffix);
>>              }
>>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-02-28  1:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-27  1:49 [Qemu-devel] [PATCH] bootdevice: fix segment fault when booting guest with '-kernel' and '-initrd' arei.gonglei
2015-02-27 14:15 ` Paolo Bonzini
2015-02-28  1:06   ` Gonglei

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).