net: annotate sk->sk_err write from do_recvmmsg()
Subsystems (3)
PATCH 1/1 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.
--- net/socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/socket.c +1 -1
@@ -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);
Signature · 1 line
2.40.1.521.gf1e218fcd8-goog
From: Eric Dumazet <[email protected]>
Date: Tue, 9 May 2023 16:35:53 +0000
Quoted 8 lines
do_recvmmsg()can write tosk->sk_errfrom multiple threads.As said before, many other points reading or writing
sk_errneed annotations.Fixes 34b88a68f26a ("net: Fix use after free in the recvmmsg exit path")Signed-off-by Eric Dumazet <[email protected]>Reported-by syzbot <[email protected]>
Quoted 19 lines
--- net/socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)net/socket.c +1
-1@@ -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);Signature · 1 line
2.40.1.521.gf1e218fcd8-goog
This patch was applied to netdev/net.git (main) by David S. Miller <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by David S. Miller <[email protected]>:
Quoted 10 lines · On Tue, 9 May 2023 16:35:53 +0000 you wrote:
do_recvmmsg()can write tosk->sk_errfrom multiple threads.As said before, many other points reading or writing
sk_errneed annotations.Fixes 34b88a68f26a ("net: Fix use after free in the recvmmsg exit path")Signed-off-by Eric Dumazet <[email protected]>Reported-by syzbot <[email protected]>[...]
Here is the summary with links:
- [net] net: annotate sk->sk_err write from do_recvmmsg()
https://git.kernel.org/netdev/net/c/e05a5f510f26
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html