Patch "bpf, sockmap: Avoid potential NULL dereference in sk_psock_verdict_data_ready()" has been added to the 5.15-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

    bpf, sockmap: Avoid potential NULL dereference in sk_psock_verdict_data_ready()

to the 5.15-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:
     bpf-sockmap-avoid-potential-null-dereference-in-sk_p.patch
and it can be found in the queue-5.15 subdirectory.

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



commit b8beca67eaa0d62d309047f1e0474ac189cf61f5
Author: Eric Dumazet <edumazet@xxxxxxxxxx>
Date:   Tue May 30 19:51:49 2023 +0000

    bpf, sockmap: Avoid potential NULL dereference in sk_psock_verdict_data_ready()
    
    [ Upstream commit b320a45638296b63be8d9a901ca8bc43716b1ae1 ]
    
    syzbot found sk_psock(sk) could return NULL when called
    from sk_psock_verdict_data_ready().
    
    Just make sure to handle this case.
    
    [1]
    general protection fault, probably for non-canonical address 0xdffffc000000005c: 0000 [#1] PREEMPT SMP KASAN
    KASAN: null-ptr-deref in range [0x00000000000002e0-0x00000000000002e7]
    CPU: 0 PID: 15 Comm: ksoftirqd/0 Not tainted 6.4.0-rc3-syzkaller-00588-g4781e965e655 #0
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/16/2023
    RIP: 0010:sk_psock_verdict_data_ready+0x19f/0x3c0 net/core/skmsg.c:1213
    Code: 4c 89 e6 e8 63 70 5e f9 4d 85 e4 75 75 e8 19 74 5e f9 48 8d bb e0 02 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 07 02 00 00 48 89 ef ff 93 e0 02 00 00 e8 29 fd
    RSP: 0018:ffffc90000147688 EFLAGS: 00010206
    RAX: dffffc0000000000 RBX: 0000000000000000 RCX: 0000000000000100
    RDX: 000000000000005c RSI: ffffffff8825ceb7 RDI: 00000000000002e0
    RBP: ffff888076518c40 R08: 0000000000000007 R09: 0000000000000000
    R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000000
    R13: 0000000000000000 R14: 0000000000008000 R15: ffff888076518c40
    FS: 0000000000000000(0000) GS:ffff8880b9800000(0000) knlGS:0000000000000000
    CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 00007f901375bab0 CR3: 000000004bf26000 CR4: 00000000003506f0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    Call Trace:
    <TASK>
    tcp_data_ready+0x10a/0x520 net/ipv4/tcp_input.c:5006
    tcp_data_queue+0x25d3/0x4c50 net/ipv4/tcp_input.c:5080
    tcp_rcv_established+0x829/0x1f90 net/ipv4/tcp_input.c:6019
    tcp_v4_do_rcv+0x65a/0x9c0 net/ipv4/tcp_ipv4.c:1726
    tcp_v4_rcv+0x2cbf/0x3340 net/ipv4/tcp_ipv4.c:2148
    ip_protocol_deliver_rcu+0x9f/0x480 net/ipv4/ip_input.c:205
    ip_local_deliver_finish+0x2ec/0x520 net/ipv4/ip_input.c:233
    NF_HOOK include/linux/netfilter.h:303 [inline]
    NF_HOOK include/linux/netfilter.h:297 [inline]
    ip_local_deliver+0x1ae/0x200 net/ipv4/ip_input.c:254
    dst_input include/net/dst.h:468 [inline]
    ip_rcv_finish+0x1cf/0x2f0 net/ipv4/ip_input.c:449
    NF_HOOK include/linux/netfilter.h:303 [inline]
    NF_HOOK include/linux/netfilter.h:297 [inline]
    ip_rcv+0xae/0xd0 net/ipv4/ip_input.c:569
    __netif_receive_skb_one_core+0x114/0x180 net/core/dev.c:5491
    __netif_receive_skb+0x1f/0x1c0 net/core/dev.c:5605
    process_backlog+0x101/0x670 net/core/dev.c:5933
    __napi_poll+0xb7/0x6f0 net/core/dev.c:6499
    napi_poll net/core/dev.c:6566 [inline]
    net_rx_action+0x8a9/0xcb0 net/core/dev.c:6699
    __do_softirq+0x1d4/0x905 kernel/softirq.c:571
    run_ksoftirqd kernel/softirq.c:939 [inline]
    run_ksoftirqd+0x31/0x60 kernel/softirq.c:931
    smpboot_thread_fn+0x659/0x9e0 kernel/smpboot.c:164
    kthread+0x344/0x440 kernel/kthread.c:379
    ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308
    </TASK>
    
    Fixes: 6df7f764cd3c ("bpf, sockmap: Wake up polling after data copy")
    Reported-by: syzbot <syzkaller@xxxxxxxxxxxxxxxx>
    Signed-off-by: Eric Dumazet <edumazet@xxxxxxxxxx>
    Signed-off-by: Daniel Borkmann <daniel@xxxxxxxxxxxxx>
    Reviewed-by: John Fastabend <john.fastabend@xxxxxxxxx>
    Link: https://lore.kernel.org/bpf/20230530195149.68145-1-edumazet@xxxxxxxxxx
    Stable-dep-of: 6648e613226e ("bpf, skmsg: Fix NULL pointer dereference in sk_psock_skb_ingress_enqueue")
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/core/skmsg.c b/net/core/skmsg.c
index 75554adef5df9..4b851a43cb0b7 100644
--- a/net/core/skmsg.c
+++ b/net/core/skmsg.c
@@ -1223,7 +1223,8 @@ static void sk_psock_verdict_data_ready(struct sock *sk)
 
 		rcu_read_lock();
 		psock = sk_psock(sk);
-		psock->saved_data_ready(sk);
+		if (psock)
+			psock->saved_data_ready(sk);
 		rcu_read_unlock();
 	}
 }




[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