Greg Kroah-Hartman
unread,May 22, 2023, 3:12:49 PMMay 22Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message as abuse
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to sta...@vger.kernel.org, Greg Kroah-Hartman, pat...@lists.linux.dev, Eric Dumazet, syzbot, Kuniyuki Iwashima, David S. Miller, Sasha Levin
From: Eric Dumazet <
edum...@google.com>
[ Upstream commit e05a5f510f26607616fecdd4ac136310c8bea56b ]
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 <
edum...@google.com>
Reported-by: syzbot <
syzk...@googlegroups.com>
Reviewed-by: Kuniyuki Iwashima <
kun...@amazon.com>
Signed-off-by: David S. Miller <
da...@davemloft.net>
Signed-off-by: Sasha Levin <
sas...@kernel.org>
---
net/socket.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/socket.c b/net/socket.c
index 73666b878f2ce..5c49074ef7f2a 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -2820,7 +2820,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);
--
2.39.2