dmar: Fix double free in error paths following c/s a8bc99b
PATCH 1/1 dmar: Fix double free in error paths following c/s a8bc99b
Several error paths would end up freeing scope->devices twice.
Signed-off-by Andrew Cooper <[email protected]>
CC Jan Beulich <[email protected]>
CC Elena Ufimtseva <[email protected]>
CC Yang Zhang <[email protected]>
CC Kevin Tian <[email protected]>
--- xen/drivers/passthrough/vtd/dmar.c | 1 + 1 file changed, 1 insertion(+)
xen/drivers/passthrough/vtd/dmar.c +1 -0
@@ -88,6 +88,7 @@ static void scope_devices_free(struct dmar_scope *scope) scope->devices_cnt =0 ;xfree (scope->devices); + scope->devices =NULL ; }static void __init disable_all_dmar_units (void )
Signature · 1 line
1.7.10.4
Quoted 2 lines
Quoted 1 line
Quoted 1 line · On 16.07.15 at 13:57, <[email protected]> wrote:
Several error paths would end up freeing
scope->devicestwice.
Of course it depends how you count, but I can spot exactly one broken case - in acpi_parse_dev_scope(). All other callers of scope_devices_free() free the container right afterwards afaics.
Jan
Quoted 10 lines
From: Andrew Cooper [mailto:[email protected]]
Sent: Thursday, July 16, 2015 7:57 PMSeveral error paths would end up freeing
scope->devicestwice.Signed-off-by Andrew Cooper <[email protected]>CC Jan Beulich <[email protected]>CC Elena Ufimtseva <[email protected]>CC Yang Zhang <[email protected]>CC Kevin Tian <[email protected]>
Acked-by Kevin Tian <[email protected]>
Quoted 18 lines
--- xen/drivers/passthrough/vtd/dmar.c | 1 + 1 file changed, 1 insertion(+)xen/drivers/passthrough/vtd/dmar.c +1
-1@@ -88,6 +88,7 @@ static void scope_devices_free(struct dmar_scope *scope) scope->devices_cnt =0 ;xfree (scope->devices); + scope->devices =NULL ; }static void __init disable_all_dmar_units (void ) --1.7.10.4