Patch "netlink: do not reset transport header in netlink_recvmsg()" has been added to the 4.9-stable tree

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

 



This is a note to let you know that I've just added the patch titled

    netlink: do not reset transport header in netlink_recvmsg()

to the 4.9-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     netlink-do-not-reset-transport-header-in-netlink_rec.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 92b14381f5424aa3e04e9b14ca7642e0e1c27b21
Author: Eric Dumazet <edumazet@xxxxxxxxxx>
Date:   Thu May 5 09:19:46 2022 -0700

    netlink: do not reset transport header in netlink_recvmsg()
    
    [ Upstream commit d5076fe4049cadef1f040eda4aaa001bb5424225 ]
    
    netlink_recvmsg() does not need to change transport header.
    
    If transport header was needed, it should have been reset
    by the producer (netlink_dump()), not the consumer(s).
    
    The following trace probably happened when multiple threads
    were using MSG_PEEK.
    
    BUG: KCSAN: data-race in netlink_recvmsg / netlink_recvmsg
    
    write to 0xffff88811e9f15b2 of 2 bytes by task 32012 on cpu 1:
     skb_reset_transport_header include/linux/skbuff.h:2760 [inline]
     netlink_recvmsg+0x1de/0x790 net/netlink/af_netlink.c:1978
     sock_recvmsg_nosec net/socket.c:948 [inline]
     sock_recvmsg net/socket.c:966 [inline]
     __sys_recvfrom+0x204/0x2c0 net/socket.c:2097
     __do_sys_recvfrom net/socket.c:2115 [inline]
     __se_sys_recvfrom net/socket.c:2111 [inline]
     __x64_sys_recvfrom+0x74/0x90 net/socket.c:2111
     do_syscall_x64 arch/x86/entry/common.c:50 [inline]
     do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80
     entry_SYSCALL_64_after_hwframe+0x44/0xae
    
    write to 0xffff88811e9f15b2 of 2 bytes by task 32005 on cpu 0:
     skb_reset_transport_header include/linux/skbuff.h:2760 [inline]
     netlink_recvmsg+0x1de/0x790 net/netlink/af_netlink.c:1978
     ____sys_recvmsg+0x162/0x2f0
     ___sys_recvmsg net/socket.c:2674 [inline]
     __sys_recvmsg+0x209/0x3f0 net/socket.c:2704
     __do_sys_recvmsg net/socket.c:2714 [inline]
     __se_sys_recvmsg net/socket.c:2711 [inline]
     __x64_sys_recvmsg+0x42/0x50 net/socket.c:2711
     do_syscall_x64 arch/x86/entry/common.c:50 [inline]
     do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80
     entry_SYSCALL_64_after_hwframe+0x44/0xae
    
    value changed: 0xffff -> 0x0000
    
    Reported by Kernel Concurrency Sanitizer on:
    CPU: 0 PID: 32005 Comm: syz-executor.4 Not tainted 5.18.0-rc1-syzkaller-00328-ge1f700ebd6be-dirty #0
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Signed-off-by: Eric Dumazet <edumazet@xxxxxxxxxx>
    Reported-by: syzbot <syzkaller@xxxxxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20220505161946.2867638-1-eric.dumazet@xxxxxxxxx
    Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index a8674e9ff37b..47b1631bf14c 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -1929,7 +1929,6 @@ static int netlink_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
 		copied = len;
 	}
 
-	skb_reset_transport_header(data_skb);
 	err = skb_copy_datagram_msg(data_skb, 0, msg, copied);
 
 	if (msg->msg_name) {



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux