summaryrefslogtreecommitdiffstats
path: root/net/socket.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2023-05-09 16:35:53 +0000
committerDavid S. Miller <davem@davemloft.net>2023-05-10 09:58:29 +0100
commite05a5f510f26607616fecdd4ac136310c8bea56b (patch)
treea1629634b94064bbf20ac4e65b5f0885c0078d4e /net/socket.c
parenta939d14919b799e6fff8a9c80296ca229ba2f8a4 (diff)
downloadlinux-stable-e05a5f510f26607616fecdd4ac136310c8bea56b.tar.gz
linux-stable-e05a5f510f26607616fecdd4ac136310c8bea56b.tar.bz2
linux-stable-e05a5f510f26607616fecdd4ac136310c8bea56b.zip
net: annotate sk->sk_err write from do_recvmmsg()
do_recvmmsg() can write to sk->sk_err from multiple threads. As said before, many other points reading or writing sk_err need annotations. Fixes: 34b88a68f26a ("net: Fix use after free in the recvmmsg exit path") Signed-off-by: Eric Dumazet <edumazet@google.com> Reported-by: syzbot <syzkaller@googlegroups.com> Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/socket.c')
-rw-r--r--net/socket.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/socket.c b/net/socket.c
index a7b4b37d86df..b7e01d0fe082 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -2911,7 +2911,7 @@ static int do_recvmmsg(int fd, struct mmsghdr __user *mmsg,
* error to return on the next call or if the
* app asks about it using getsockopt(SO_ERROR).
*/
- sock->sk->sk_err = -err;
+ WRITE_ONCE(sock->sk->sk_err, -err);
}
out_put:
fput_light(sock->file, fput_needed);