From: Eric Dumazet <eric.dumazet@gmail.com>
To: Jakub Kicinski <kuba@kernel.org>, eric.dumazet@gmail.com
Cc: willemb@google.com, netdev@vger.kernel.org
Subject: Re: [RFC net] net: stream: don't purge sk_error_queue without holding its lock
Date: Mon, 13 Sep 2021 22:14:00 -0700 [thread overview]
Message-ID: <3b5549a2-cb0e-0dc1-3cb3-00d15a74873b@gmail.com> (raw)
In-Reply-To: <20210913223850.660578-1-kuba@kernel.org>
On 9/13/21 3:38 PM, Jakub Kicinski wrote:
> 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));
>
This should not be needed.
By definition, sk_stream_kill_queues() is only called when there is no
more references on the sockets.
So all outstanding packets must have been orphaned or freed.
Anyway, Linux-2.6.12-rc2 had no timestamps yet.
next prev parent reply other threads:[~2021-09-14 5:14 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3b5549a2-cb0e-0dc1-3cb3-00d15a74873b@gmail.com \
--to=eric.dumazet@gmail.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=willemb@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).