Module: xenomai-forge
Branch: master
Commit: fdc9e579e580b57ef899bbdc39f798a8c7a97ac8
URL:    
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=fdc9e579e580b57ef899bbdc39f798a8c7a97ac8

Author: Jan Kiszka <jan.kis...@siemens.com>
Date:   Wed Aug 28 18:03:15 2013 +0200

cobalt/shadow: Fix use after release

post_ppd_release, called by xnheap_destroy_mapped, will release the
xnsys_ppd we are accessing later on for freeing exe_path. Reorder things
properly.

Signed-off-by: Jan Kiszka <jan.kis...@siemens.com>

---

 kernel/cobalt/shadow.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/kernel/cobalt/shadow.c b/kernel/cobalt/shadow.c
index fd3220f..8977bee 100644
--- a/kernel/cobalt/shadow.c
+++ b/kernel/cobalt/shadow.c
@@ -1700,11 +1700,10 @@ static void user_process_detach(struct xnshadow_ppd 
*ppd)
        struct xnsys_ppd *p;
 
        p = container_of(ppd, struct xnsys_ppd, ppd);
-       xnheap_destroy_mapped(&p->sem_heap, post_ppd_release, NULL);
-       atomic_dec(&personalities[user_muxid]->refcnt);
-
        if (p->exe_path)
                kfree(p->exe_path);
+       xnheap_destroy_mapped(&p->sem_heap, post_ppd_release, NULL);
+       atomic_dec(&personalities[user_muxid]->refcnt);
 }
 
 static struct xnsyscall user_syscalls[] = {


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git

Reply via email to