Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 95dd65f2 authored by Eric Dumazet's avatar Eric Dumazet Committed by Greg Kroah-Hartman
Browse files

net: add missing data-race annotations around sk->sk_peek_off



[ Upstream commit 11695c6e966b0ec7ed1d16777d294cef865a5c91 ]

sk_getsockopt() runs locklessly, thus we need to annotate the read
of sk->sk_peek_off.

While we are at it, add corresponding annotations to sk_set_peek_off()
and unix_set_peek_off().

Fixes: b9bb53f3 ("sock: convert sk_peek_offset functions to WRITE_ONCE")
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Cc: Willem de Bruijn <willemb@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 8a6dddcb
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1444,7 +1444,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname,
		if (!sock->ops->set_peek_off)
			return -EOPNOTSUPP;

		v.val = sk->sk_peek_off;
		v.val = READ_ONCE(sk->sk_peek_off);
		break;
	case SO_NOFCS:
		v.val = sock_flag(sk, SOCK_NOFCS);
@@ -2652,7 +2652,7 @@ EXPORT_SYMBOL(__sk_mem_reclaim);

int sk_set_peek_off(struct sock *sk, int val)
{
	sk->sk_peek_off = val;
	WRITE_ONCE(sk->sk_peek_off, val);
	return 0;
}
EXPORT_SYMBOL_GPL(sk_set_peek_off);
+1 −1
Original line number Diff line number Diff line
@@ -701,7 +701,7 @@ static int unix_set_peek_off(struct sock *sk, int val)
	if (mutex_lock_interruptible(&u->iolock))
		return -EINTR;

	sk->sk_peek_off = val;
	WRITE_ONCE(sk->sk_peek_off, val);
	mutex_unlock(&u->iolock);

	return 0;