Skip to content

Commit 3f32d0b

Browse files
Parthasarathy Bhuvaragandavem330
authored andcommitted
tipc: lock wakeup & inputq at tipc_link_reset()
In tipc_link_reset() we copy the wakeup queue to input queue using skb_queue_splice_init(link->wakeupq, link->inputq). This is performed without holding any locks. The lists might be simultaneously be accessed by other cpu threads in tipc_sk_rcv(), something leading to to random missing packets. Signed-off-by: Parthasarathy Bhuvaragan <parthasarathy.bhuvaragan@ericsson.com> Signed-off-by: Jon Maloy <jon.maloy@ericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 94b6ddc commit 3f32d0b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

net/tipc/link.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -841,9 +841,14 @@ void tipc_link_reset(struct tipc_link *l)
841841
l->in_session = false;
842842
l->session++;
843843
l->mtu = l->advertised_mtu;
844+
spin_lock_bh(&l->wakeupq.lock);
845+
spin_lock_bh(&l->inputq->lock);
846+
skb_queue_splice_init(&l->wakeupq, l->inputq);
847+
spin_unlock_bh(&l->inputq->lock);
848+
spin_unlock_bh(&l->wakeupq.lock);
849+
844850
__skb_queue_purge(&l->transmq);
845851
__skb_queue_purge(&l->deferdq);
846-
skb_queue_splice_init(&l->wakeupq, l->inputq);
847852
__skb_queue_purge(&l->backlogq);
848853
l->backlog[TIPC_LOW_IMPORTANCE].len = 0;
849854
l->backlog[TIPC_MEDIUM_IMPORTANCE].len = 0;

0 commit comments

Comments
 (0)