Hello,
syzbot has tested the proposed patch but the reproducer is still triggering an issue:
memory leak in j1939_sk_sendmsg
BUG: memory leak
unreferenced object 0xffff8881191b5100 (size 232):
comm "syz-executor.5", pid 4213, jiffies 4294942958 (age 10.400s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 ad 0e 81 88 ff ff 00 a0 02 19 81 88 ff ff ................
backtrace:
[<ffffffff837dcff6>] __alloc_skb+0x216/0x290 net/core/skbuff.c:414
[<ffffffff837e2a1a>] alloc_skb include/linux/skbuff.h:1300 [inline]
[<ffffffff837e2a1a>] alloc_skb_with_frags+0x6a/0x340 net/core/skbuff.c:5995
[<ffffffff837d4d43>] sock_alloc_send_pskb+0x353/0x3c0 net/core/sock.c:2600
[<ffffffff83dd440f>] j1939_sk_alloc_skb net/can/j1939/socket.c:861 [inline]
[<ffffffff83dd440f>] j1939_sk_send_loop net/can/j1939/socket.c:1118 [inline]
[<ffffffff83dd440f>] j1939_sk_sendmsg+0x2cf/0x810 net/can/j1939/socket.c:1253
[<ffffffff837cb476>] sock_sendmsg_nosec net/socket.c:705 [inline]
[<ffffffff837cb476>] sock_sendmsg+0x56/0x80 net/socket.c:725
[<ffffffff837cb9dc>] ____sys_sendmsg+0x36c/0x390 net/socket.c:2413
[<ffffffff837cfa4b>] ___sys_sendmsg+0x8b/0xd0 net/socket.c:2467
[<ffffffff837cfb48>] __sys_sendmsg+0x88/0x100 net/socket.c:2496
[<ffffffff8451da35>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
[<ffffffff8451da35>] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
[<ffffffff84600068>] entry_SYSCALL_64_after_hwframe+0x44/0xae
BUG: memory leak
unreferenced object 0xffff8881191bae00 (size 512):
comm "syz-executor.5", pid 4213, jiffies 4294942958 (age 10.400s)
hex dump (first 32 bytes):
0e 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 64 00 00 00 00 00 00 00 ........d.......
backtrace:
[<ffffffff837dcec3>] kmalloc_reserve net/core/skbuff.c:354 [inline]
[<ffffffff837dcec3>] __alloc_skb+0xe3/0x290 net/core/skbuff.c:426
[<ffffffff837e2a1a>] alloc_skb include/linux/skbuff.h:1300 [inline]
[<ffffffff837e2a1a>] alloc_skb_with_frags+0x6a/0x340 net/core/skbuff.c:5995
[<ffffffff837d4d43>] sock_alloc_send_pskb+0x353/0x3c0 net/core/sock.c:2600
[<ffffffff83dd440f>] j1939_sk_alloc_skb net/can/j1939/socket.c:861 [inline]
[<ffffffff83dd440f>] j1939_sk_send_loop net/can/j1939/socket.c:1118 [inline]
[<ffffffff83dd440f>] j1939_sk_sendmsg+0x2cf/0x810 net/can/j1939/socket.c:1253
[<ffffffff837cb476>] sock_sendmsg_nosec net/socket.c:705 [inline]
[<ffffffff837cb476>] sock_sendmsg+0x56/0x80 net/socket.c:725
[<ffffffff837cb9dc>] ____sys_sendmsg+0x36c/0x390 net/socket.c:2413
[<ffffffff837cfa4b>] ___sys_sendmsg+0x8b/0xd0 net/socket.c:2467
[<ffffffff837cfb48>] __sys_sendmsg+0x88/0x100 net/socket.c:2496
[<ffffffff8451da35>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
[<ffffffff8451da35>] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
[<ffffffff84600068>] entry_SYSCALL_64_after_hwframe+0x44/0xae
BUG: memory leak
unreferenced object 0xffff88811924a400 (size 1024):
comm "syz-executor.5", pid 4215, jiffies 4294942962 (age 10.360s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
1d 00 07 41 00 00 00 00 00 00 00 00 00 00 00 00 ...A............
backtrace:
[<ffffffff837d1a72>] kmalloc include/linux/slab.h:586 [inline]
[<ffffffff837d1a72>] sk_prot_alloc+0xd2/0x1b0 net/core/sock.c:1936
[<ffffffff837d5652>] sk_alloc+0x32/0x2e0 net/core/sock.c:1989
[<ffffffff83dc56a8>] can_create+0x108/0x300 net/can/af_can.c:158
[<ffffffff837ca28b>] __sock_create+0x1ab/0x2b0 net/socket.c:1468
[<ffffffff837cd20f>] sock_create net/socket.c:1519 [inline]
[<ffffffff837cd20f>] __sys_socket+0x6f/0x140 net/socket.c:1561
[<ffffffff837cd2fa>] __do_sys_socket net/socket.c:1570 [inline]
[<ffffffff837cd2fa>] __se_sys_socket net/socket.c:1568 [inline]
[<ffffffff837cd2fa>] __x64_sys_socket+0x1a/0x20 net/socket.c:1568
[<ffffffff8451da35>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
[<ffffffff8451da35>] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
[<ffffffff84600068>] entry_SYSCALL_64_after_hwframe+0x44/0xae
BUG: memory leak
unreferenced object 0xffff8881191b1500 (size 32):
comm "syz-executor.5", pid 4215, jiffies 4294942962 (age 10.360s)
hex dump (first 32 bytes):
b0 2e 04 40 81 88 ff ff 00 00 00 00 00 00 00 00 ...@............
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<ffffffff822050b3>] kmalloc include/linux/slab.h:581 [inline]
[<ffffffff822050b3>] kzalloc include/linux/slab.h:714 [inline]
[<ffffffff822050b3>] apparmor_sk_alloc_security+0x53/0xd0 security/apparmor/lsm.c:792
[<ffffffff821cac71>] security_sk_alloc+0x31/0x70 security/security.c:2279
[<ffffffff837d1a8d>] sk_prot_alloc+0xed/0x1b0 net/core/sock.c:1939
[<ffffffff837d5652>] sk_alloc+0x32/0x2e0 net/core/sock.c:1989
[<ffffffff83dc56a8>] can_create+0x108/0x300 net/can/af_can.c:158
[<ffffffff837ca28b>] __sock_create+0x1ab/0x2b0 net/socket.c:1468
[<ffffffff837cd20f>] sock_create net/socket.c:1519 [inline]
[<ffffffff837cd20f>] __sys_socket+0x6f/0x140 net/socket.c:1561
[<ffffffff837cd2fa>] __do_sys_socket net/socket.c:1570 [inline]
[<ffffffff837cd2fa>] __se_sys_socket net/socket.c:1568 [inline]
[<ffffffff837cd2fa>] __x64_sys_socket+0x1a/0x20 net/socket.c:1568
[<ffffffff8451da35>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
[<ffffffff8451da35>] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
[<ffffffff84600068>] entry_SYSCALL_64_after_hwframe+0x44/0xae
BUG: memory leak
unreferenced object 0xffff8881191c2d00 (size 232):
comm "syz-executor.5", pid 4215, jiffies 4294942962 (age 10.360s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 ad 0e 81 88 ff ff 00 a4 24 19 81 88 ff ff ..........$.....
backtrace:
[<ffffffff837dcff6>] __alloc_skb+0x216/0x290 net/core/skbuff.c:414
[<ffffffff837e2a1a>] alloc_skb include/linux/skbuff.h:1300 [inline]
[<ffffffff837e2a1a>] alloc_skb_with_frags+0x6a/0x340 net/core/skbuff.c:5995
[<ffffffff837d4d43>] sock_alloc_send_pskb+0x353/0x3c0 net/core/sock.c:2600
[<ffffffff83dd440f>] j1939_sk_alloc_skb net/can/j1939/socket.c:861 [inline]
[<ffffffff83dd440f>] j1939_sk_send_loop net/can/j1939/socket.c:1118 [inline]
[<ffffffff83dd440f>] j1939_sk_sendmsg+0x2cf/0x810 net/can/j1939/socket.c:1253
[<ffffffff837cb476>] sock_sendmsg_nosec net/socket.c:705 [inline]
[<ffffffff837cb476>] sock_sendmsg+0x56/0x80 net/socket.c:725
[<ffffffff837cb9dc>] ____sys_sendmsg+0x36c/0x390 net/socket.c:2413
[<ffffffff837cfa4b>] ___sys_sendmsg+0x8b/0xd0 net/socket.c:2467
[<ffffffff837cfb48>] __sys_sendmsg+0x88/0x100 net/socket.c:2496
[<ffffffff8451da35>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
[<ffffffff8451da35>] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
[<ffffffff84600068>] entry_SYSCALL_64_after_hwframe+0x44/0xae
Tested on:
commit: d569e869 Merge tag 'drm-fixes-2022-04-22' of git://ano..
git tree: upstream
console output:
https://syzkaller.appspot.com/x/log.txt?x=127876e8f00000
kernel config:
https://syzkaller.appspot.com/x/.config?x=2e0170f940d4be96
patch:
https://syzkaller.appspot.com/x/patch.diff?x=15f0200cf00000