]> git.ozlabs.org Git - petitboot/commitdiff
discover/boot: Fix use-after-free in boot()
authorJeremy Kerr <jk@ozlabs.org>
Thu, 19 Sep 2013 13:07:19 +0000 (21:07 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Thu, 19 Sep 2013 13:36:33 +0000 (21:36 +0800)
We need boot_task for kexec_reboot.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
discover/boot.c

index 8ad83beb6a98673ecfea8844406da4c0f662078f..e7a72d4330c67d4586912cfb2e2c2994f3095203 100644 (file)
@@ -371,8 +371,6 @@ no_load:
        if (clean_dtb)
                unlink(boot_task->local_dtb);
 
-       talloc_free(boot_task);
-
        if (!result) {
                update_status(status_fn, status_arg, BOOT_STATUS_INFO,
                                "performing kexec reboot");
@@ -385,5 +383,7 @@ no_load:
                }
        }
 
+       talloc_free(boot_task);
+
        return result;
 }