netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC net] net: stream: don't purge sk_error_queue without holding its lock
@ 2021-09-13 22:38 Jakub Kicinski
  2021-09-14  5:14 ` Eric Dumazet
  0 siblings, 1 reply; 7+ messages in thread
From: Jakub Kicinski @ 2021-09-13 22:38 UTC (permalink / raw)
  To: eric.dumazet; +Cc: willemb, netdev, Jakub Kicinski

sk_stream_kill_queues() can be called when there are still
outstanding skbs to transmit. Those skbs may try to queue
notifications to the error queue (e.g. timestamps).
If sk_stream_kill_queues() purges the queue without taking
its lock the queue may get corrupted.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
Sending as an RFC for review, compile-tested only.

Seems far more likely that I'm missing something than that
this has been broken forever and nobody noticed :S
---
 net/core/stream.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/stream.c b/net/core/stream.c
index 4f1d4aa5fb38..7c585088f394 100644
--- a/net/core/stream.c
+++ b/net/core/stream.c
@@ -196,7 +196,7 @@ void sk_stream_kill_queues(struct sock *sk)
 	__skb_queue_purge(&sk->sk_receive_queue);
 
 	/* Next, the error queue. */
-	__skb_queue_purge(&sk->sk_error_queue);
+	skb_queue_purge(&sk->sk_error_queue);
 
 	/* Next, the write queue. */
 	WARN_ON(!skb_queue_empty(&sk->sk_write_queue));
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-09-14 18:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-13 22:38 [RFC net] net: stream: don't purge sk_error_queue without holding its lock Jakub Kicinski
2021-09-14  5:14 ` Eric Dumazet
2021-09-14 14:18   ` Jakub Kicinski
2021-09-14 16:32     ` Eric Dumazet
2021-09-14 16:56       ` Jakub Kicinski
2021-09-14 17:55         ` Eric Dumazet
2021-09-14 18:03           ` Jakub Kicinski

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).