diff options
-rw-r--r-- | include/net/inet_frag.h | 5 | ||||
-rw-r--r-- | net/ipv4/inet_fragment.c | 1 |
2 files changed, 4 insertions, 2 deletions
diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h index 4182c9be8bb5..bfcbc0017950 100644 --- a/include/net/inet_frag.h +++ b/include/net/inet_frag.h @@ -141,14 +141,15 @@ static inline int sum_frag_mem_limit(struct netns_frags *nf) static inline void inet_frag_lru_move(struct inet_frag_queue *q) { spin_lock(&q->net->lru_lock); - list_move_tail(&q->lru_list, &q->net->lru_list); + if (!list_empty(&q->lru_list)) + list_move_tail(&q->lru_list, &q->net->lru_list); spin_unlock(&q->net->lru_lock); } static inline void inet_frag_lru_del(struct inet_frag_queue *q) { spin_lock(&q->net->lru_lock); - list_del(&q->lru_list); + list_del_init(&q->lru_list); q->net->nqueues--; spin_unlock(&q->net->lru_lock); } diff --git a/net/ipv4/inet_fragment.c b/net/ipv4/inet_fragment.c index e97d66a1fdde..7e06641e36ae 100644 --- a/net/ipv4/inet_fragment.c +++ b/net/ipv4/inet_fragment.c @@ -305,6 +305,7 @@ static struct inet_frag_queue *inet_frag_alloc(struct netns_frags *nf, setup_timer(&q->timer, f->frag_expire, (unsigned long)q); spin_lock_init(&q->lock); atomic_set(&q->refcnt, 1); + INIT_LIST_HEAD(&q->lru_list); return q; } |