[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210316094137.GA12946@amd>
Date: Tue, 16 Mar 2021 10:41:37 +0100
From: Pavel Machek <pavel@...x.de>
To: gregkh@...uxfoundation.org
Cc: linux-kernel@...r.kernel.org, stable@...r.kernel.org,
Eric Dumazet <edumazet@...gle.com>,
"David S. Miller" <davem@...emloft.net>
Subject: Re: [PATCH 4.19 011/120] tcp: annotate tp->copied_seq lockless reads
Hi!
> From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
>
> From: Eric Dumazet <edumazet@...gle.com>
Two From: fields here.
> [ Upstream commit 7db48e983930285b765743ebd665aecf9850582b ]
>
> There are few places where we fetch tp->copied_seq while
> this field can change from IRQ or other cpu.
And there are few such places even after the patch is applied; I
quoted them below.
Doing addition to variable without locking... is kind of
interesting. Are you sure it is okay?
> @@ -2112,7 +2112,7 @@ int tcp_recvmsg(struct sock *sk, struct
> if (urg_offset < used) {
> if (!urg_offset) {
> if (!sock_flag(sk, SOCK_URGINLINE)) {
> - ++*seq;
> + WRITE_ONCE(*seq, *seq + 1);
> urg_hole++;
> offset++;
> used--;
> @@ -2134,7 +2134,7 @@ int tcp_recvmsg(struct sock *sk, struct
> }
> }
>
> - *seq += used;
> + WRITE_ONCE(*seq, *seq + used);
> copied += used;
> len -= used;
>
> @@ -2163,7 +2163,7 @@ skip_copy:
>
> found_fin_ok:
> /* Process the FIN. */
> - ++*seq;
> + WRITE_ONCE(*seq, *seq + 1);
> if (!(flags & MSG_PEEK))
> sk_eat_skb(sk, skb);
> break;
Best regards,
Pavel
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Download attachment "signature.asc" of type "application/pgp-signature" (182 bytes)
Powered by blists - more mailing lists