aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/inet_frag.h5
-rw-r--r--net/ipv4/inet_fragment.c1
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)
141static inline void inet_frag_lru_move(struct inet_frag_queue *q) 141static inline void inet_frag_lru_move(struct inet_frag_queue *q)
142{ 142{
143 spin_lock(&q->net->lru_lock); 143 spin_lock(&q->net->lru_lock);
144 list_move_tail(&q->lru_list, &q->net->lru_list); 144 if (!list_empty(&q->lru_list))
145 list_move_tail(&q->lru_list, &q->net->lru_list);
145 spin_unlock(&q->net->lru_lock); 146 spin_unlock(&q->net->lru_lock);
146} 147}
147 148
148static inline void inet_frag_lru_del(struct inet_frag_queue *q) 149static inline void inet_frag_lru_del(struct inet_frag_queue *q)
149{ 150{
150 spin_lock(&q->net->lru_lock); 151 spin_lock(&q->net->lru_lock);
151 list_del(&q->lru_list); 152 list_del_init(&q->lru_list);
152 q->net->nqueues--; 153 q->net->nqueues--;
153 spin_unlock(&q->net->lru_lock); 154 spin_unlock(&q->net->lru_lock);
154} 155}
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,
305 setup_timer(&q->timer, f->frag_expire, (unsigned long)q); 305 setup_timer(&q->timer, f->frag_expire, (unsigned long)q);
306 spin_lock_init(&q->lock); 306 spin_lock_init(&q->lock);
307 atomic_set(&q->refcnt, 1); 307 atomic_set(&q->refcnt, 1);
308 INIT_LIST_HEAD(&q->lru_list);
308 309
309 return q; 310 return q;
310} 311}