Skip to contentSkip to conversation

Change the order of g_free(info) and tracepoint

PATCH In review Kirti Wankhede 4 participants 4 messages Nov 6, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Change the order of g_free(info) and tracepoint

Fixes Coverity issue:
CID 1436126: Memory - illegal accesses (USE_AFTER_FREE)

Fixes a9e271ec9b36 ("vfio: Add migration region initialization and finalize

function")

---
 hw/vfio/migration.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/vfio/migration.c +1 -1
index 3ce285ea395d..55261562d4f3 100644
@@ -897,8 +897,8 @@ int vfio_migration_probe(VFIODevice *vbasedev, Error **errp)
         goto add_blocker;
     }
 
-    g_free(info);
     trace_vfio_migration_probe(vbasedev->name, info->index);
+    g_free(info);
     return 0;
 
 add_blocker:
Signature · 1 line
2.7.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Kirti Wankhede

Fixes Coverity issue:
CID 1436126: Memory - illegal accesses (USE_AFTER_FREE)

Fixes a9e271ec9b36 ("vfio: Add migration region initialization and finalize

function")

Maybe "fix use after free in vfio_migration_probe" as a summary?

Quoted 20 lines
---
 hw/vfio/migration.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/vfio/migration.c +1 -1
index 3ce285ea395d..55261562d4f3 100644
@@ -897,8 +897,8 @@ int vfio_migration_probe(VFIODevice *vbasedev, Error **errp)
         goto add_blocker;
     }
 
-    g_free(info);
     trace_vfio_migration_probe(vbasedev->name, info->index);
+    g_free(info);
     return 0;
 
 add_blocker:
Signature · 1 line
2.7.0

dme.

Signature · 1 line
I think I waited too long, I'm moving into the dollhouse.
#2 lore raw
Quoted 11 lines · David Edmondson
Quoted 7 lines · Kirti Wankhede

Fixes Coverity issue:
CID 1436126: Memory - illegal accesses (USE_AFTER_FREE)

Fixes a9e271ec9b36 ("vfio: Add migration region initialization and finalize

function")

Maybe "fix use after free in vfio_migration_probe" as a summary?

Yes please :)

Quoted 26 lines
Quoted 20 lines
---
 hw/vfio/migration.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/vfio/migration.c +1 -1
index 3ce285ea395d..55261562d4f3 100644
@@ -897,8 +897,8 @@ int vfio_migration_probe(VFIODevice *vbasedev, Error **errp)
         goto add_blocker;
     }
 
-    g_free(info);
     trace_vfio_migration_probe(vbasedev->name, info->index);
+    g_free(info);
     return 0;
 
 add_blocker:
Signature · 1 line
2.7.0

dme.