From: Jeremy Kerr Date: Wed, 9 Oct 2013 08:37:25 +0000 (+0800) Subject: discover/device-handler: Fix use-after-free when unmounting X-Git-Tag: v1.0.0~397 X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=commitdiff_plain;h=96eedc649c8c0909a564787afebcfbe0588fd651 discover/device-handler: Fix use-after-free when unmounting We need to do the rmdir after clearing mount_path. Signed-off-by: Jeremy Kerr --- diff --git a/discover/device-handler.c b/discover/device-handler.c index 04a4484..94abb51 100644 --- a/discover/device-handler.c +++ b/discover/device-handler.c @@ -803,11 +803,12 @@ static int umount_device(struct discover_device *dev) return -1; dev->mounted = false; - talloc_free(dev->mount_path); - dev->mount_path = NULL; pb_rmdir_recursive(mount_base(), dev->mount_path); + talloc_free(dev->mount_path); + dev->mount_path = NULL; + return 0; }