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

Author: Wolfgang Mauerer <wolfgang.maue...@siemens.com>
Date:   Tue Mar 30 11:13:33 2010 +0200

RTDM: Fix potential NULL pointer dereference

The rework in 95278926edc559d4 misses the case that context can be NULL,
which can (and has) triggered a kernel oops. Take care of this case.

Signed-off-by: Wolfgang Mauerer <wolfgang.maue...@siemens.com>
Signed-off-by: Jan Kiszka <jan.kis...@siemens.com>

---

 ksrc/skins/rtdm/core.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/ksrc/skins/rtdm/core.c b/ksrc/skins/rtdm/core.c
index 8677c47..8cccf52 100644
--- a/ksrc/skins/rtdm/core.c
+++ b/ksrc/skins/rtdm/core.c
@@ -175,7 +175,7 @@ static int cleanup_instance(struct rtdm_device *device,
 
        xnlock_get_irqsave(&rt_fildes_lock, s);
 
-       if (unlikely(atomic_read(&context->close_lock_count) > 1)) {
+       if (context && unlikely(atomic_read(&context->close_lock_count) > 1)) {
                xnlock_put_irqrestore(&rt_fildes_lock, s);
                return -EAGAIN;
        }


_______________________________________________
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git

Reply via email to