net: add a READ_ONCE() in skb_peek_tail()
[linux-2.6-block.git] / include / linux / skbuff.h
index 53238ac725a326a1f9c41f915c51b1e9cfdb0217..dfe02b658829d93b297fee0249c5997b3c10465b 100644 (file)
@@ -1795,7 +1795,7 @@ static inline struct sk_buff *skb_peek_next(struct sk_buff *skb,
  */
 static inline struct sk_buff *skb_peek_tail(const struct sk_buff_head *list_)
 {
-       struct sk_buff *skb = list_->prev;
+       struct sk_buff *skb = READ_ONCE(list_->prev);
 
        if (skb == (struct sk_buff *)list_)
                skb = NULL;
@@ -1861,7 +1861,9 @@ static inline void __skb_insert(struct sk_buff *newsk,
                                struct sk_buff *prev, struct sk_buff *next,
                                struct sk_buff_head *list)
 {
-       /* see skb_queue_empty_lockless() for the opposite READ_ONCE() */
+       /* See skb_queue_empty_lockless() and skb_peek_tail()
+        * for the opposite READ_ONCE()
+        */
        WRITE_ONCE(newsk->next, next);
        WRITE_ONCE(newsk->prev, prev);
        WRITE_ONCE(next->prev, newsk);