* [net 1/1] tipc: lock wakeup & inputq at tipc_link_reset()
@ 2018-09-25 20:09 Jon Maloy
2018-09-26 3:49 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Jon Maloy @ 2018-09-25 20:09 UTC (permalink / raw)
To: davem, netdev
Cc: gordan.mihaljevic, tung.q.nguyen, hoang.h.le, jon.maloy,
canh.d.luu, ying.xue, tipc-discussion
From: Parthasarathy Bhuvaragan <parthasarathy.bhuvaragan@ericsson.com>
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>
---
net/tipc/link.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/net/tipc/link.c b/net/tipc/link.c
index b1f0bee..26cc033 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -841,9 +841,14 @@ void tipc_link_reset(struct tipc_link *l)
l->in_session = false;
l->session++;
l->mtu = l->advertised_mtu;
+ spin_lock_bh(&l->wakeupq.lock);
+ spin_lock_bh(&l->inputq->lock);
+ skb_queue_splice_init(&l->wakeupq, l->inputq);
+ spin_unlock_bh(&l->inputq->lock);
+ spin_unlock_bh(&l->wakeupq.lock);
+
__skb_queue_purge(&l->transmq);
__skb_queue_purge(&l->deferdq);
- skb_queue_splice_init(&l->wakeupq, l->inputq);
__skb_queue_purge(&l->backlogq);
l->backlog[TIPC_LOW_IMPORTANCE].len = 0;
l->backlog[TIPC_MEDIUM_IMPORTANCE].len = 0;
--
2.1.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [net 1/1] tipc: lock wakeup & inputq at tipc_link_reset()
2018-09-25 20:09 [net 1/1] tipc: lock wakeup & inputq at tipc_link_reset() Jon Maloy
@ 2018-09-26 3:49 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-09-26 3:49 UTC (permalink / raw)
To: jon.maloy; +Cc: netdev, tipc-discussion
From: Jon Maloy <jon.maloy@ericsson.com>
Date: Tue, 25 Sep 2018 22:09:10 +0200
> From: Parthasarathy Bhuvaragan <parthasarathy.bhuvaragan@ericsson.com>
>
> 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>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-09-26 3:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-25 20:09 [net 1/1] tipc: lock wakeup & inputq at tipc_link_reset() Jon Maloy
2018-09-26 3:49 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).