Eric Dumazet
f3969427fb
af_unix: fix struct pid leaks in OOB support
...
[ Upstream commit 2aab4b96900272885bc157f8b236abf1cdc02e08 ]
syzbot reported struct pid leak [1].
Issue is that queue_oob() calls maybe_add_creds() which potentially
holds a reference on a pid.
But skb->destructor is not set (either directly or by calling
unix_scm_to_skb())
This means that subsequent kfree_skb() or consume_skb() would leak
this reference.
In this fix, I chose to fully support scm even for the OOB message.
[1]
BUG: memory leak
unreferenced object 0xffff8881053e7f80 (size 128):
comm "syz-executor242", pid 5066, jiffies 4294946079 (age 13.220s)
hex dump (first 32 bytes):
01 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:
[<ffffffff812ae26a>] alloc_pid+0x6a/0x560 kernel/pid.c:180
[<ffffffff812718df>] copy_process+0x169f/0x26c0 kernel/fork.c:2285
[<ffffffff81272b37>] kernel_clone+0xf7/0x610 kernel/fork.c:2684
[<ffffffff812730cc>] __do_sys_clone+0x7c/0xb0 kernel/fork.c:2825
[<ffffffff849ad699>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
[<ffffffff849ad699>] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
[<ffffffff84a0008b>] entry_SYSCALL_64_after_hwframe+0x63/0xcd
Fixes: 314001f0bf92 ("af_unix: Add OOB support")
Reported-by: syzbot+7699d9e5635c10253a27@syzkaller.appspotmail.com
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Rao Shoaib <rao.shoaib@oracle.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Link: https://lore.kernel.org/r/20230307164530.771896-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-03-17 08:48:57 +01:00
..
2023-03-11 13:57:29 +01:00
2022-12-31 13:14:42 +01:00
2022-08-31 17:16:37 +02:00
2022-10-29 10:12:55 +02:00
2022-06-22 14:22:01 +02:00
2022-07-29 17:25:07 +02:00
2023-03-11 13:57:39 +01:00
2022-12-31 13:14:11 +01:00
2023-03-11 13:57:28 +01:00
2023-03-17 08:48:54 +01:00
2023-02-14 19:17:57 +01:00
2022-05-25 09:57:28 +02:00
2023-03-11 13:57:28 +01:00
2022-03-08 19:12:52 +01:00
2023-02-22 12:57:08 +01:00
2022-08-03 12:03:51 +02:00
2022-12-31 13:14:21 +01:00
2023-01-24 07:22:41 +01:00
2022-12-31 13:14:15 +01:00
2022-11-03 23:59:14 +09:00
2023-03-17 08:48:55 +01:00
2023-03-17 08:48:55 +01:00
2021-08-09 10:13:32 +01:00
2022-11-26 09:24:50 +01:00
2022-12-02 17:41:06 +01:00
2023-03-10 09:39:18 +01:00
2022-04-27 14:38:53 +02:00
2022-03-28 09:58:46 +02:00
2023-03-10 09:39:18 +01:00
2022-12-14 11:37:25 +01:00
2023-02-06 07:59:02 +01:00
2023-02-22 12:57:09 +01:00
2023-02-22 12:57:05 +01:00
2022-01-05 12:42:37 +01:00
2023-03-17 08:48:56 +01:00
2022-04-13 20:59:10 +02:00
2023-02-01 08:27:27 +01:00
2023-02-09 11:26:36 +01:00
2023-03-17 08:48:49 +01:00
2023-02-22 12:57:09 +01:00
2023-01-12 11:58:49 +01:00
2022-01-11 15:35:16 +01:00
2023-02-09 11:26:41 +01:00
2023-03-10 09:39:16 +01:00
2022-04-08 14:23:00 +02:00
2023-02-22 12:57:02 +01:00
2022-12-31 13:14:39 +01:00
2023-03-11 13:57:30 +01:00
2023-03-11 13:57:28 +01:00
2023-03-17 08:48:56 +01:00
2021-11-18 19:17:11 +01:00
2023-03-17 08:48:57 +01:00
2023-01-18 11:48:54 +01:00
2023-03-11 13:57:39 +01:00
2023-03-17 08:48:57 +01:00
2022-12-31 13:14:18 +01:00
2023-03-13 10:20:37 +01:00
2023-02-09 11:26:40 +01:00
2022-10-26 12:34:40 +02:00
2023-03-03 11:45:51 +01:00
2022-08-31 17:16:45 +02:00