Skip to contentSkip to conversation

ioemu: Fix the segmentation fault on assigning device without PM cap.

PATCH In review Yuji Shimada 2 participants 2 messages Feb 19, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ioemu: Fix the segmentation fault on assigning device without PM cap.

This patch fixes the segmentation fault on assigning device without Power Management Capability Structure.

Please apply this patch after applying the following patch I have submitted.

[PATCH] ioemu: Cleanup the code of PCI passthrough.

Thanks,
--
Yuji Shimada.

hw/pass-through.c +3 -3
index 855f69c..305ea59 100644
@@ -1165,7 +1165,7 @@ static void pt_pci_write_config(PCIDevice *d, uint32_t address, uint32_t val,
     }
 
     /* check power state transition flags */
-    if (pm_state->flags & PT_FLAG_TRANSITING)
+    if (pm_state != NULL && pm_state->flags & PT_FLAG_TRANSITING)
         /* can't accept untill previous power state transition is completed.
          * so finished previous request here.
          */
@@ -1280,7 +1280,7 @@ out:
     if (!ret)
         PT_LOG("Error: pci_write_block failed. return value[%d].\n", ret);
 
-    if (pm_state->flags & PT_FLAG_TRANSITING)
+    if (pm_state != NULL && pm_state->flags & PT_FLAG_TRANSITING)
         /* set QEMUTimer */
         qemu_mod_timer(pm_state->pm_timer,
             (qemu_get_clock(rt_clock) + pm_state->pm_delay));
@@ -1337,7 +1337,7 @@ static uint32_t pt_pci_read_config(PCIDevice *d, uint32_t address, int len)
     }
 
     /* check power state transition flags */
-    if (pm_state->flags & PT_FLAG_TRANSITING)
+    if (pm_state != NULL && pm_state->flags & PT_FLAG_TRANSITING)
         /* can't accept untill previous power state transition is completed.
          * so finished previous request here.
          */
Tested-by on v1 1/1
#1 lore raw
Quoted 7 lines · Yuji Shimada

This patch fixes the segmentation fault on assigning device without Power Management Capability Structure.

Please apply this patch after applying the following patch I have submitted.

[PATCH] ioemu: Cleanup the code of PCI passthrough.

Hi Shimada-san,

thanks for the patch, I can confirm that it resolves the problem that I was seeing.

Quoted 34 lines
hw/pass-through.c +3 -3
index 855f69c..305ea59 100644
@@ -1165,7 +1165,7 @@ static void pt_pci_write_config(PCIDevice *d, uint32_t address, uint32_t val,
     }
 
     /* check power state transition flags */
-    if (pm_state->flags & PT_FLAG_TRANSITING)
+    if (pm_state != NULL && pm_state->flags & PT_FLAG_TRANSITING)
         /* can't accept untill previous power state transition is completed.
          * so finished previous request here.
          */
@@ -1280,7 +1280,7 @@ out:
     if (!ret)
         PT_LOG("Error: pci_write_block failed. return value[%d].\n", ret);
 
-    if (pm_state->flags & PT_FLAG_TRANSITING)
+    if (pm_state != NULL && pm_state->flags & PT_FLAG_TRANSITING)
         /* set QEMUTimer */
         qemu_mod_timer(pm_state->pm_timer,
             (qemu_get_clock(rt_clock) + pm_state->pm_delay));
@@ -1337,7 +1337,7 @@ static uint32_t pt_pci_read_config(PCIDevice *d, uint32_t address, int len)
     }
 
     /* check power state transition flags */
-    if (pm_state->flags & PT_FLAG_TRANSITING)
+    if (pm_state != NULL && pm_state->flags & PT_FLAG_TRANSITING)
         /* can't accept untill previous power state transition is completed.
          * so finished previous request here.
          */
Signature · 3 lines
Simon Horman
  VA Linux Systems Japan K.K., Sydney, Australia Satellite Office
  H: www.vergenet.net/~horms/             W: www.valinux.co.jp/en