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 0xffff888113967400 (size 232):
comm "syz-executor.6", pid 10594, jiffies 4294944574 (age 13.620s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 82 10 81 88 ff ff 00 20 60 28 81 88 ff ff ......... `(....
backtrace:
[<ffffffff836da3df>] __alloc_skb+0x20f/0x280 net/core/skbuff.c:414
[<ffffffff836e4c1a>] alloc_skb include/linux/skbuff.h:1112 [inline]
[<ffffffff836e4c1a>] alloc_skb_with_frags+0x6a/0x2b0 net/core/skbuff.c:6004
[<ffffffff836d2773>] sock_alloc_send_pskb+0x353/0x3c0 net/core/sock.c:2377
[<ffffffff83c94a5f>] j1939_sk_alloc_skb net/can/j1939/socket.c:861 [inline]
[<ffffffff83c94a5f>] j1939_sk_send_loop net/can/j1939/socket.c:1043 [inline]
[<ffffffff83c94a5f>] j1939_sk_sendmsg+0x2cf/0x800 net/can/j1939/socket.c:1178
[<ffffffff836c93e6>] sock_sendmsg_nosec net/socket.c:702 [inline]
[<ffffffff836c93e6>] sock_sendmsg+0x56/0x80 net/socket.c:722
[<ffffffff836cf7af>] sock_no_sendpage+0x8f/0xc0 net/core/sock.c:2875
[<ffffffff836c8cb3>] kernel_sendpage.part.0+0xa3/0x140 net/socket.c:3666
[<ffffffff836c99cb>] kernel_sendpage net/socket.c:3663 [inline]
[<ffffffff836c99cb>] sock_sendpage+0x5b/0x90 net/socket.c:995
[<ffffffff815c6af2>] pipe_to_sendpage+0xa2/0x110 fs/splice.c:364
[<ffffffff815c8992>] splice_from_pipe_feed fs/splice.c:418 [inline]
[<ffffffff815c8992>] __splice_from_pipe+0x1e2/0x330 fs/splice.c:562
[<ffffffff815c91bf>] splice_from_pipe fs/splice.c:597 [inline]
[<ffffffff815c91bf>] generic_splice_sendpage+0x6f/0xa0 fs/splice.c:746
[<ffffffff815c6bab>] do_splice_from fs/splice.c:767 [inline]
[<ffffffff815c6bab>] direct_splice_actor+0x4b/0x70 fs/splice.c:936
[<ffffffff815c72c3>] splice_direct_to_actor+0x153/0x350 fs/splice.c:891
[<ffffffff815c75a8>] do_splice_direct+0xe8/0x150 fs/splice.c:979
[<ffffffff815680af>] do_sendfile+0x51f/0x760 fs/read_write.c:1260
[<ffffffff8156a9e2>] __do_sys_sendfile64 fs/read_write.c:1325 [inline]
[<ffffffff8156a9e2>] __se_sys_sendfile64 fs/read_write.c:1311 [inline]
[<ffffffff8156a9e2>] __x64_sys_sendfile64+0xe2/0x100 fs/read_write.c:1311
BUG: memory leak
unreferenced object 0xffff888113967900 (size 232):
comm "syz-executor.6", pid 10594, jiffies 4294944575 (age 13.610s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 82 10 81 88 ff ff 00 20 60 28 81 88 ff ff ......... `(....
backtrace:
[<ffffffff836da3df>] __alloc_skb+0x20f/0x280 net/core/skbuff.c:414
[<ffffffff836e4c1a>] alloc_skb include/linux/skbuff.h:1112 [inline]
[<ffffffff836e4c1a>] alloc_skb_with_frags+0x6a/0x2b0 net/core/skbuff.c:6004
[<ffffffff836d2773>] sock_alloc_send_pskb+0x353/0x3c0 net/core/sock.c:2377
[<ffffffff83c94a5f>] j1939_sk_alloc_skb net/can/j1939/socket.c:861 [inline]
[<ffffffff83c94a5f>] j1939_sk_send_loop net/can/j1939/socket.c:1043 [inline]
[<ffffffff83c94a5f>] j1939_sk_sendmsg+0x2cf/0x800 net/can/j1939/socket.c:1178
[<ffffffff836c93e6>] sock_sendmsg_nosec net/socket.c:702 [inline]
[<ffffffff836c93e6>] sock_sendmsg+0x56/0x80 net/socket.c:722
[<ffffffff836cf7af>] sock_no_sendpage+0x8f/0xc0 net/core/sock.c:2875
[<ffffffff836c8cb3>] kernel_sendpage.part.0+0xa3/0x140 net/socket.c:3666
[<ffffffff836c99cb>] kernel_sendpage net/socket.c:3663 [inline]
[<ffffffff836c99cb>] sock_sendpage+0x5b/0x90 net/socket.c:995
[<ffffffff815c6af2>] pipe_to_sendpage+0xa2/0x110 fs/splice.c:364
[<ffffffff815c8992>] splice_from_pipe_feed fs/splice.c:418 [inline]
[<ffffffff815c8992>] __splice_from_pipe+0x1e2/0x330 fs/splice.c:562
[<ffffffff815c91bf>] splice_from_pipe fs/splice.c:597 [inline]
[<ffffffff815c91bf>] generic_splice_sendpage+0x6f/0xa0 fs/splice.c:746
[<ffffffff815c6bab>] do_splice_from fs/splice.c:767 [inline]
[<ffffffff815c6bab>] direct_splice_actor+0x4b/0x70 fs/splice.c:936
[<ffffffff815c72c3>] splice_direct_to_actor+0x153/0x350 fs/splice.c:891
[<ffffffff815c75a8>] do_splice_direct+0xe8/0x150 fs/splice.c:979
[<ffffffff815680af>] do_sendfile+0x51f/0x760 fs/read_write.c:1260
[<ffffffff8156a9e2>] __do_sys_sendfile64 fs/read_write.c:1325 [inline]
[<ffffffff8156a9e2>] __se_sys_sendfile64 fs/read_write.c:1311 [inline]
[<ffffffff8156a9e2>] __x64_sys_sendfile64+0xe2/0x100 fs/read_write.c:1311
BUG: memory leak
unreferenced object 0xffff888128952c00 (size 1024):
comm "syz-executor.6", pid 10594, jiffies 4294944575 (age 13.610s)
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 00 00 00 00 00 00 00 00 ................
backtrace:
[<ffffffff836da2af>] kmalloc_reserve net/core/skbuff.c:355 [inline]
[<ffffffff836da2af>] __alloc_skb+0xdf/0x280 net/core/skbuff.c:426
[<ffffffff836e4c1a>] alloc_skb include/linux/skbuff.h:1112 [inline]
[<ffffffff836e4c1a>] alloc_skb_with_frags+0x6a/0x2b0 net/core/skbuff.c:6004
[<ffffffff836d2773>] sock_alloc_send_pskb+0x353/0x3c0 net/core/sock.c:2377
[<ffffffff83c94a5f>] j1939_sk_alloc_skb net/can/j1939/socket.c:861 [inline]
[<ffffffff83c94a5f>] j1939_sk_send_loop net/can/j1939/socket.c:1043 [inline]
[<ffffffff83c94a5f>] j1939_sk_sendmsg+0x2cf/0x800 net/can/j1939/socket.c:1178
[<ffffffff836c93e6>] sock_sendmsg_nosec net/socket.c:702 [inline]
[<ffffffff836c93e6>] sock_sendmsg+0x56/0x80 net/socket.c:722
[<ffffffff836cf7af>] sock_no_sendpage+0x8f/0xc0 net/core/sock.c:2875
[<ffffffff836c8cb3>] kernel_sendpage.part.0+0xa3/0x140 net/socket.c:3666
[<ffffffff836c99cb>] kernel_sendpage net/socket.c:3663 [inline]
[<ffffffff836c99cb>] sock_sendpage+0x5b/0x90 net/socket.c:995
[<ffffffff815c6af2>] pipe_to_sendpage+0xa2/0x110 fs/splice.c:364
[<ffffffff815c8992>] splice_from_pipe_feed fs/splice.c:418 [inline]
[<ffffffff815c8992>] __splice_from_pipe+0x1e2/0x330 fs/splice.c:562
[<ffffffff815c91bf>] splice_from_pipe fs/splice.c:597 [inline]
[<ffffffff815c91bf>] generic_splice_sendpage+0x6f/0xa0 fs/splice.c:746
[<ffffffff815c6bab>] do_splice_from fs/splice.c:767 [inline]
[<ffffffff815c6bab>] direct_splice_actor+0x4b/0x70 fs/splice.c:936
[<ffffffff815c72c3>] splice_direct_to_actor+0x153/0x350 fs/splice.c:891
[<ffffffff815c75a8>] do_splice_direct+0xe8/0x150 fs/splice.c:979
[<ffffffff815680af>] do_sendfile+0x51f/0x760 fs/read_write.c:1260
[<ffffffff8156a9e2>] __do_sys_sendfile64 fs/read_write.c:1325 [inline]
[<ffffffff8156a9e2>] __se_sys_sendfile64 fs/read_write.c:1311 [inline]
[<ffffffff8156a9e2>] __x64_sys_sendfile64+0xe2/0x100 fs/read_write.c:1311
Tested on:
commit: 2a8927f0 Add linux-next specific files for 20210624
git tree:
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
console output:
https://syzkaller.appspot.com/x/log.txt?x=11e2ea90300000
kernel config:
https://syzkaller.appspot.com/x/.config?x=45f6a7a3f5d3951
dashboard link:
https://syzkaller.appspot.com/bug?extid=d56eaa979f1a3d6e2e2e
compiler: