WANG Cong
afb4feb8bf
ping: fix a null pointer dereference
[ Upstream commit 73d2c6678e ]
Andrey reported a kernel crash:
general protection fault: 0000 [#1] SMP KASAN
Dumping ftrace buffer:
(ftrace buffer empty)
Modules linked in:
CPU: 2 PID: 3880 Comm: syz-executor1 Not tainted 4.10.0-rc6+ #124
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
task: ffff880060048040 task.stack: ffff880069be8000
RIP: 0010:ping_v4_push_pending_frames net/ipv4/ping.c:647 [inline]
RIP: 0010:ping_v4_sendmsg+0x1acd/0x23f0 net/ipv4/ping.c:837
RSP: 0018:ffff880069bef8b8 EFLAGS: 00010206
RAX: dffffc0000000000 RBX: ffff880069befb90 RCX: 0000000000000000
RDX: 0000000000000018 RSI: ffff880069befa30 RDI: 00000000000000c2
RBP: ffff880069befbb8 R08: 0000000000000008 R09: 0000000000000000
R10: 0000000000000002 R11: 0000000000000000 R12: ffff880069befab0
R13: ffff88006c624a80 R14: ffff880069befa70 R15: 0000000000000000
FS: 00007f6f7c716700(0000) GS:ffff88006de00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00000000004a6f28 CR3: 000000003a134000 CR4: 00000000000006e0
Call Trace:
inet_sendmsg+0x164/0x5b0 net/ipv4/af_inet.c:744
sock_sendmsg_nosec net/socket.c:635 [inline]
sock_sendmsg+0xca/0x110 net/socket.c:645
SYSC_sendto+0x660/0x810 net/socket.c:1687
SyS_sendto+0x40/0x50 net/socket.c:1655
entry_SYSCALL_64_fastpath+0x1f/0xc2
This is because we miss a check for NULL pointer for skb_peek() when
the queue is empty. Other places already have the same check.
Fixes: c319b4d76b ("net: ipv4: add IPPROTO_ICMP socket kind")
Reported-by: Andrey Konovalov <andreyknvl@google.com>
Tested-by: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-18 16:39:27 +01:00
..
2016-06-24 10:18:24 -07:00
2016-11-15 07:46:38 +01:00
2015-08-25 13:38:50 -07:00
2015-10-20 06:08:27 -07:00
2017-02-18 16:39:26 +01:00
2015-07-29 22:44:04 -07:00
2016-04-20 15:42:03 +09:00
2016-12-10 19:07:26 +01:00
2017-01-15 13:41:35 +01:00
2015-07-24 22:46:11 -07:00
2015-09-09 14:19:50 -07:00
2017-02-04 09:45:08 +01:00
2016-11-21 10:06:40 +01:00
2016-11-15 07:46:38 +01:00
2015-08-10 14:03:54 -07:00
2016-11-15 07:46:38 +01:00
2015-10-14 06:01:07 -07:00
2017-01-15 13:41:35 +01:00
2016-03-03 15:07:07 -08:00
2015-10-03 04:32:41 -07:00
2015-11-02 22:47:14 -05:00
2015-10-23 05:42:21 -07:00
2015-09-21 16:32:29 -07:00
2015-08-28 13:32:36 -07:00
2015-10-08 04:26:54 -07:00
2016-03-03 15:07:04 -08:00
2016-06-24 10:18:18 -07:00
2015-10-12 19:44:16 -07:00
2016-12-10 19:07:26 +01:00
2017-02-18 16:39:26 +01:00
2016-10-31 04:13:59 -06:00
2016-06-24 10:18:18 -07:00
2016-09-30 10:18:36 +02:00
2015-10-18 19:23:52 -07:00
2015-12-18 16:07:59 -05:00
2016-11-15 07:46:37 +01:00
2015-08-27 15:42:48 -07:00
2015-10-21 07:00:48 -07:00
2015-09-29 20:21:32 +02:00
2017-02-18 16:39:27 +01:00
2015-07-21 22:36:33 -07:00
2016-03-03 15:07:06 -08:00
2017-02-04 09:45:08 +01:00
2015-10-23 05:42:21 -07:00
2016-11-15 07:46:38 +01:00
2015-07-09 14:22:52 -07:00
2015-07-09 14:22:52 -07:00
2015-09-25 13:00:38 -07:00
2015-09-17 22:35:07 -07:00
2016-11-21 10:06:39 +01:00
2015-11-15 18:36:38 -05:00
2017-02-04 09:45:09 +01:00
2015-07-09 14:22:52 -07:00
2015-07-09 14:22:52 -07:00
2015-07-09 14:22:52 -07:00
2015-07-09 14:22:52 -07:00
2016-11-15 07:46:36 +01:00
2016-11-21 10:06:40 +01:00
2016-04-20 15:41:56 +09:00
2016-04-20 15:42:00 +09:00
2017-02-18 16:39:26 +01:00
2015-10-21 07:00:53 -07:00
2015-07-09 14:22:52 -07:00
2015-11-20 10:51:12 -05:00
2015-07-09 14:22:52 -07:00
2015-07-09 14:22:52 -07:00
2016-09-30 10:18:34 +02:00
2017-02-18 16:39:27 +01:00
2016-11-15 07:46:38 +01:00
2016-04-20 15:41:56 +09:00
2016-11-15 07:46:39 +01:00
2015-09-17 17:18:37 -07:00
2015-10-24 06:54:12 -07:00
2015-12-22 16:26:31 -05:00