Re: [PATCH 4.19 011/120] tcp: annotate tp->copied_seq lockless reads

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!

> From: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> 
> From: Eric Dumazet <edumazet@xxxxxxxxxx>

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

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux