]> git.hungrycats.org Git - linux/commitdiff
[PATCH] hlist_add_after() fix
authorAndrew Morton <akpm@osdl.org>
Tue, 20 Apr 2004 00:22:29 +0000 (17:22 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Tue, 20 Apr 2004 00:22:29 +0000 (17:22 -0700)
From: "Pedro Emanuel M. D. Pinto" <pepinto@student.dei.uc.pt>

This currently-unused function is incorrectly implemented.  Fix.

include/linux/list.h

index 34fd74e050df462fbc20f3321ce32b82318a501b..9e0c971ded6f7284328c747d03e45e401ac59944 100644 (file)
@@ -610,9 +610,12 @@ static inline void hlist_add_before(struct hlist_node *n,
 static inline void hlist_add_after(struct hlist_node *n,
                                        struct hlist_node *next)
 {
-       next->next      = n->next;
-       *(next->pprev)  = n;
-       n->next         = next;
+       next->next = n->next;
+       n->next = next;
+       next->pprev = &n->next;
+
+       if(next->next)
+               next->next->pprev  = &next->next;
 }
 
 #define hlist_entry(ptr, type, member) container_of(ptr,type,member)