Eric Dumazet
55cd9f67f1
net_sched: ematch: reject invalid TCF_EM_SIMPLE
It is possible for malicious userspace to set TCF_EM_SIMPLE bit
even for matches that should not have this bit set.
This can fool two places using tcf_em_is_simple()
1) tcf_em_tree_destroy() -> memory leak of em->data
if ops->destroy() is NULL
2) tcf_em_tree_dump() wrongly report/leak 4 low-order bytes
of a kernel pointer.
BUG: memory leak
unreferenced object 0xffff888121850a40 (size 32):
comm "syz-executor927", pid 7193, jiffies 4294941655 (age 19.840s)
hex dump (first 32 bytes):
00 00 00 00 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 ................
backtrace:
[<00000000f67036ea>] kmemleak_alloc_recursive include/linux/kmemleak.h:43 [inline]
[<00000000f67036ea>] slab_post_alloc_hook mm/slab.h:586 [inline]
[<00000000f67036ea>] slab_alloc mm/slab.c:3320 [inline]
[<00000000f67036ea>] __do_kmalloc mm/slab.c:3654 [inline]
[<00000000f67036ea>] __kmalloc_track_caller+0x165/0x300 mm/slab.c:3671
[<00000000fab0cc8e>] kmemdup+0x27/0x60 mm/util.c:127
[<00000000d9992e0a>] kmemdup include/linux/string.h:453 [inline]
[<00000000d9992e0a>] em_nbyte_change+0x5b/0x90 net/sched/em_nbyte.c:32
[<000000007e04f711>] tcf_em_validate net/sched/ematch.c:241 [inline]
[<000000007e04f711>] tcf_em_tree_validate net/sched/ematch.c:359 [inline]
[<000000007e04f711>] tcf_em_tree_validate+0x332/0x46f net/sched/ematch.c:300
[<000000007a769204>] basic_set_parms net/sched/cls_basic.c:157 [inline]
[<000000007a769204>] basic_change+0x1d7/0x5f0 net/sched/cls_basic.c:219
[<00000000e57a5997>] tc_new_tfilter+0x566/0xf70 net/sched/cls_api.c:2104
[<0000000074b68559>] rtnetlink_rcv_msg+0x3b2/0x4b0 net/core/rtnetlink.c:5415
[<00000000b7fe53fb>] netlink_rcv_skb+0x61/0x170 net/netlink/af_netlink.c:2477
[<00000000e83a40d0>] rtnetlink_rcv+0x1d/0x30 net/core/rtnetlink.c:5442
[<00000000d62ba933>] netlink_unicast_kernel net/netlink/af_netlink.c:1302 [inline]
[<00000000d62ba933>] netlink_unicast+0x223/0x310 net/netlink/af_netlink.c:1328
[<0000000088070f72>] netlink_sendmsg+0x2c0/0x570 net/netlink/af_netlink.c:1917
[<00000000f70b15ea>] sock_sendmsg_nosec net/socket.c:639 [inline]
[<00000000f70b15ea>] sock_sendmsg+0x54/0x70 net/socket.c:659
[<00000000ef95a9be>] ____sys_sendmsg+0x2d0/0x300 net/socket.c:2330
[<00000000b650f1ab>] ___sys_sendmsg+0x8a/0xd0 net/socket.c:2384
[<0000000055bfa74a>] __sys_sendmsg+0x80/0xf0 net/socket.c:2417
[<000000002abac183>] __do_sys_sendmsg net/socket.c:2426 [inline]
[<000000002abac183>] __se_sys_sendmsg net/socket.c:2424 [inline]
[<000000002abac183>] __x64_sys_sendmsg+0x23/0x30 net/socket.c:2424
Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: syzbot+03c4738ed29d5d366ddf@syzkaller.appspotmail.com
Cc: Cong Wang <xiyou.wangcong@gmail.com>
Acked-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-27 10:55:26 +01:00
..
2019-09-27 15:10:34 -07:00
2019-12-09 10:36:44 -08:00
2020-01-09 12:13:43 -08:00
2019-09-24 16:37:18 +02:00
2020-01-26 10:40:21 +01:00
2020-01-09 18:41:40 -08:00
2020-01-19 22:10:04 +01:00
2019-12-12 21:38:57 -08:00
2019-12-18 17:05:58 -08:00
2020-01-24 12:58:14 +01:00
2020-01-24 08:12:06 +01:00
2019-12-08 11:52:02 +01:00
2019-11-27 22:28:37 +01:00
2020-01-26 10:40:21 +01:00
2019-12-09 10:36:44 -08:00
2020-01-09 18:41:40 -08:00
2020-01-19 22:10:04 +01:00
2019-11-07 20:07:30 -08:00
2020-01-08 16:03:35 -08:00
2020-01-21 12:03:21 +01:00
2019-11-02 13:54:56 -07:00
2019-09-26 08:56:17 +02:00
2020-01-27 10:54:08 +01:00
2020-01-26 10:40:21 +01:00
2019-12-09 10:36:44 -08:00
2019-09-27 10:27:14 +02:00
2020-01-03 12:26:07 -08:00
2019-12-20 21:19:36 -08:00
2020-01-19 22:10:04 +01:00
2019-12-04 12:27:13 -08:00
2020-01-25 08:14:39 +01:00
2020-01-09 18:36:22 -08:00
2020-01-27 08:54:30 +01:00
2019-09-01 11:45:02 -07:00
2019-12-09 10:36:44 -08:00
2019-10-24 14:53:48 -07:00
2019-12-18 11:57:33 -08:00
2020-01-14 11:48:41 -08:00
2019-12-26 15:19:59 -08:00
2020-01-03 12:25:50 -08:00
2019-11-26 14:40:13 -08:00
2020-01-14 18:36:42 -08:00
2020-01-18 11:48:19 +02:00
2019-12-16 10:15:49 +01:00
2020-01-26 10:40:21 +01:00
2019-12-24 16:12:47 -08:00
2020-01-27 10:55:26 +01:00
2020-01-09 12:13:43 -08:00
2020-01-21 11:39:56 +01:00
2020-01-14 13:30:24 -05:00
2020-01-09 12:13:43 -08:00
2020-01-19 22:10:04 +01:00
2020-01-21 12:18:20 +01:00
2020-01-19 22:10:04 +01:00
2019-08-10 15:25:47 -07:00
2020-01-19 22:10:04 +01:00
2020-01-09 18:39:33 -08:00
2020-01-22 00:08:52 +01:00
2020-01-26 10:40:21 +01:00
2019-11-15 14:38:29 +01:00
2020-01-24 13:44:07 +01:00
2020-01-24 13:44:07 +01:00
2020-01-08 15:02:21 -08:00