Eric W. Biederman
8405a8fff3
netfilter: nf_qeueue: Drop queue entries on nf_unregister_hook
...
Add code to nf_unregister_hook to flush the nf_queue when a hook is
unregistered. This guarantees that the pointer that the nf_queue code
retains into the nf_hook list will remain valid while a packet is
queued.
I tested what would happen if we do not flush queued packets and was
trivially able to obtain the oops below. All that was required was
to stop the nf_queue listening process, to delete all of the nf_tables,
and to awaken the nf_queue listening process.
> BUG: unable to handle kernel paging request at 0000000100000001
> IP: [<0000000100000001>] 0x100000001
> PGD b9c35067 PUD 0
> Oops: 0010 [#1 ] SMP
> Modules linked in:
> CPU: 0 PID: 519 Comm: lt-nfqnl_test Not tainted
> task: ffff8800b9c8c050 ti: ffff8800ba9d8000 task.ti: ffff8800ba9d8000
> RIP: 0010:[<0000000100000001>] [<0000000100000001>] 0x100000001
> RSP: 0018:ffff8800ba9dba40 EFLAGS: 00010a16
> RAX: ffff8800bab48a00 RBX: ffff8800ba9dba90 RCX: ffff8800ba9dba90
> RDX: ffff8800b9c10128 RSI: ffff8800ba940900 RDI: ffff8800bab48a00
> RBP: ffff8800b9c10128 R08: ffffffff82976660 R09: ffff8800ba9dbb28
> R10: dead000000100100 R11: dead000000200200 R12: ffff8800ba940900
> R13: ffffffff8313fd50 R14: ffff8800b9c95200 R15: 0000000000000000
> FS: 00007fb91fc34700(0000) GS:ffff8800bfa00000(0000) knlGS:0000000000000000
> CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> CR2: 0000000100000001 CR3: 00000000babfb000 CR4: 00000000000007f0
> Stack:
> ffffffff8206ab0f ffffffff82982240 ffff8800bab48a00 ffff8800b9c100a8
> ffff8800b9c10100 0000000000000001 ffff8800ba940900 ffff8800b9c10128
> ffffffff8206bd65 ffff8800bfb0d5e0 ffff8800bab48a00 0000000000014dc0
> Call Trace:
> [<ffffffff8206ab0f>] ? nf_iterate+0x4f/0xa0
> [<ffffffff8206bd65>] ? nf_reinject+0x125/0x190
> [<ffffffff8206dee5>] ? nfqnl_recv_verdict+0x255/0x360
> [<ffffffff81386290>] ? nla_parse+0x80/0xf0
> [<ffffffff8206c42c>] ? nfnetlink_rcv_msg+0x13c/0x240
> [<ffffffff811b2fec>] ? __memcg_kmem_get_cache+0x4c/0x150
> [<ffffffff8206c2f0>] ? nfnl_lock+0x20/0x20
> [<ffffffff82068159>] ? netlink_rcv_skb+0xa9/0xc0
> [<ffffffff820677bf>] ? netlink_unicast+0x12f/0x1c0
> [<ffffffff82067ade>] ? netlink_sendmsg+0x28e/0x650
> [<ffffffff81fdd814>] ? sock_sendmsg+0x44/0x50
> [<ffffffff81fde07b>] ? ___sys_sendmsg+0x2ab/0x2c0
> [<ffffffff810e8f73>] ? __wake_up+0x43/0x70
> [<ffffffff8141a134>] ? tty_write+0x1c4/0x2a0
> [<ffffffff81fde9f4>] ? __sys_sendmsg+0x44/0x80
> [<ffffffff823ff8d7>] ? system_call_fastpath+0x12/0x6a
> Code: Bad RIP value.
> RIP [<0000000100000001>] 0x100000001
> RSP <ffff8800ba9dba40>
> CR2: 0000000100000001
> ---[ end trace 08eb65d42362793f ]---
Cc: stable@vger.kernel.org
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-06-23 06:23:23 -07:00
..
2015-06-14 10:40:18 +02:00
2015-05-25 13:25:34 -04:00
2015-06-23 06:23:23 -07:00
2015-06-15 17:26:37 +02:00
2015-05-26 18:41:23 +02:00
2015-03-18 10:51:35 +01:00
2015-02-22 15:59:54 -05:00
2015-01-15 01:50:25 -05:00
2014-06-25 19:15:38 +02:00
2015-03-18 10:51:35 +01:00
2014-10-14 02:18:24 +02:00
2015-05-25 13:25:33 -04:00
2014-10-30 17:35:30 +01:00
2013-04-18 20:27:55 +02:00
2014-11-05 14:10:33 -05:00
2013-07-31 16:39:18 +02:00
2015-01-08 12:14:20 +01:00
2014-04-08 10:56:12 +02:00
2014-11-05 14:10:33 -05:00
2015-06-12 14:06:24 +02:00
2014-11-05 14:10:33 -05:00
2014-11-05 14:10:33 -05:00
2015-05-15 20:50:56 +02:00
2014-11-05 14:10:33 -05:00
2014-11-05 14:10:33 -05:00
2014-01-03 23:41:37 +01:00
2013-02-19 02:48:05 +01:00
2015-01-05 13:52:20 +01:00
2014-10-14 02:18:24 +02:00
2013-01-18 00:28:18 +01:00
2014-11-05 14:11:02 -05:00
2013-04-18 20:27:55 +02:00
2013-01-23 12:56:02 +01:00
2013-12-20 14:58:29 +01:00
2015-06-23 06:23:23 -07:00
2015-04-08 16:49:08 +02:00
2015-03-19 11:14:48 +01:00
2013-04-18 20:27:55 +02:00
2014-08-23 12:21:21 -07:00
2013-02-19 02:48:05 +01:00
2013-08-28 00:26:48 +02:00
2014-01-06 14:17:17 +01:00
2014-06-30 11:38:03 +02:00
2014-06-30 11:38:03 +02:00
2014-06-30 11:38:03 +02:00
2014-06-30 11:38:03 +02:00
2014-06-30 11:38:03 +02:00
2014-06-30 11:38:03 +02:00
2012-08-30 03:00:14 +02:00
2014-11-27 13:08:42 +01:00
2014-10-14 02:18:24 +02:00
2013-02-19 02:48:05 +01:00
2015-06-23 06:23:23 -07:00
2014-08-08 16:47:23 +02:00
2015-06-18 21:14:30 +02:00
2015-06-15 23:02:35 +02:00
2015-06-23 06:23:22 -07:00
2014-01-09 23:25:48 +01:00
2015-06-15 23:02:35 +02:00
2014-08-26 21:36:19 +02:00
2015-03-12 13:07:36 +01:00
2013-10-01 13:17:39 +02:00
2015-06-18 21:14:27 +02:00
2015-06-23 06:23:23 -07:00
2013-08-28 00:26:48 +02:00
2015-01-15 01:50:25 -05:00
2015-04-13 17:17:30 +02:00
2015-04-13 17:17:29 +02:00
2015-04-13 17:17:30 +02:00
2015-05-15 20:14:07 +02:00
2015-04-13 20:12:31 +02:00
2015-04-13 17:17:29 +02:00
2015-04-13 20:19:55 +02:00
2015-04-13 17:17:29 +02:00
2015-04-13 17:17:31 +02:00
2015-04-13 17:17:30 +02:00
2015-04-13 20:12:31 +02:00
2015-04-13 17:17:07 +02:00
2015-04-13 20:12:32 +02:00
2015-01-19 14:52:39 +01:00
2015-04-13 17:17:29 +02:00
2015-04-13 17:17:29 +02:00
2015-04-13 17:17:29 +02:00
2015-04-13 17:17:07 +02:00
2015-04-13 17:17:31 +02:00
2015-04-13 17:17:28 +02:00
2015-04-27 13:20:34 -04:00
2015-04-27 13:20:34 -04:00
2015-06-15 20:19:20 +02:00
2015-05-25 13:25:33 -04:00
2014-03-13 14:13:19 +01:00
2014-08-02 15:03:58 -07:00
2015-04-01 11:26:42 +02:00
2014-08-23 12:21:21 -07:00
2014-09-10 12:40:10 -07:00
2013-01-18 00:28:15 +01:00
2014-11-17 12:44:20 +01:00
2013-12-06 12:37:57 -05:00
2013-04-18 20:27:55 +02:00
2014-02-05 17:46:06 +01:00
2014-11-13 12:14:42 +01:00
2014-11-05 14:11:02 -05:00
2014-08-23 12:21:21 -07:00
2014-02-19 11:41:25 +01:00
2012-09-28 11:34:33 +09:00
2014-01-09 21:36:39 +01:00
2014-08-05 18:46:26 -07:00
2013-04-18 20:27:55 +02:00
2014-06-28 18:50:35 +02:00
2015-05-14 13:00:27 +02:00
2012-10-15 13:39:12 +02:00
2012-09-21 12:11:08 +02:00
2014-04-29 18:25:14 +02:00
2013-05-15 14:11:07 +02:00
2013-12-07 23:20:45 +01:00
2014-12-23 14:20:10 +01:00
2012-08-14 21:55:30 -07:00
2015-04-08 16:49:09 +02:00
2013-06-11 02:51:03 -07:00
2014-09-30 01:02:26 -04:00
2015-02-16 17:00:47 +01:00
2014-11-27 13:08:42 +01:00
2014-06-07 11:44:39 -07:00
2015-06-14 10:40:18 +02:00
2015-06-18 13:05:09 +02:00
2014-01-14 15:15:25 -08:00
2015-02-22 15:59:54 -05:00
2015-05-15 20:14:07 +02:00
2013-08-01 11:45:15 +02:00
2015-05-25 13:25:34 -04:00
2012-09-24 14:29:01 +02:00
2015-04-13 16:40:05 -04:00