if atomic_read(kgdb_active) can ever return -1 (kgdb_active is initialized to 
-1),
tid also becomes -1, leading to reads from kgdb_info[-1] on the following lines.

Signed-off-by: Roel Kluin <[email protected]>
---
Found with Parfait, http://research.sun.com/projects/parfait/

Is returning NULL the best solution for this?

diff --git a/kernel/kgdb.c b/kernel/kgdb.c
index 9147a31..f594e25 100644
--- a/kernel/kgdb.c
+++ b/kernel/kgdb.c
@@ -539,9 +539,12 @@ static struct task_struct *getthread(struct pt_regs *regs, 
int tid)
        /*
         * Non-positive TIDs are remapped to the cpu shadow information
         */
-       if (tid == 0 || tid == -1)
+       if (tid == 0 || tid == -1) {
                tid = -atomic_read(&kgdb_active) - 2;
-       if (tid < 0) {
+               if (tid == -1)
+                       return NULL;
+       }
+       if (tid < -1) {
                if (kgdb_info[-tid - 2].task)
                        return kgdb_info[-tid - 2].task;
                else

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Kgdb-bugreport mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kgdb-bugreport

Reply via email to