From: Robin Holt Date: Wed, 16 Dec 2009 00:47:57 +0000 (-0800) Subject: x86: uv: xpc NULL deref when mesq becomes empty X-Git-Tag: v2.6.33-rc1~71^2~44 X-Git-Url: http://bbs.cooldavid.org/git/?a=commitdiff_plain;h=15b87d67ff3dc042bee42f991858d6b121b3b3ca;p=net-next-2.6.git x86: uv: xpc NULL deref when mesq becomes empty Under heavy load conditions, our set of xpc messages may become exhausted. The code handles this correctly with the exception of the management code which hits a NULL pointer dereference. Signed-off-by: Robin Holt Cc: Jack Steiner Cc: Ingo Molnar Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/misc/sgi-xp/xpc_uv.c b/drivers/misc/sgi-xp/xpc_uv.c index bbf0e2ee6fd..19bd7b0ede9 100644 --- a/drivers/misc/sgi-xp/xpc_uv.c +++ b/drivers/misc/sgi-xp/xpc_uv.c @@ -949,11 +949,13 @@ xpc_get_fifo_entry_uv(struct xpc_fifo_head_uv *head) head->first = first->next; if (head->first == NULL) head->last = NULL; + + head->n_entries--; + BUG_ON(head->n_entries < 0); + + first->next = NULL; } - head->n_entries--; - BUG_ON(head->n_entries < 0); spin_unlock_irqrestore(&head->lock, irq_flags); - first->next = NULL; return first; }