Messages in this thread | | | From | "Rose, Billy" <> | Subject | Segfault hidden in list.h | Date | Sun, 12 May 2002 19:37:25 -0500 |
| |
The code inside of __list_add:
next->prev = new; new->next = next; new->prev = prev; pre-next = new;
needs to be altered to:
new->prev = prev; new->next = next; next->prev = new; prev->next = new;
If something is accessing the list in reverse at the time of insertion and "next->prev = new;" has been executed, there exists a moment when new->prev may contain garbage if the element had been used in another list and is being transposed into a new one. Even if garbage is not present, and the element had just been initialized (i.e. new->prev = new), a false list head will appear briefly (from the executing thread's point of view).
Billy Rose wrose@loislaw.com - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |