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-04-11 22:28:27 -04:00
2015-06-18 18:11:53 +02:00
2015-02-20 17:35:14 -05:00
2014-12-10 15:33:16 -05:00
2013-04-08 17:16:57 -04:00
2015-06-23 06:23:23 -07:00
2015-06-18 21:14:31 +02:00
2015-06-11 23:37:37 +02:00
2015-05-27 14:15:26 -04:00
2015-03-20 19:10:44 -04:00
2014-10-27 15:51:16 +01:00
2014-02-12 19:23:32 -05:00
2015-05-04 14:49:23 -04:00
2014-10-25 08:07:30 +02:00
2013-07-31 17:50:01 -07:00
2015-06-10 22:49:20 -07:00
2015-05-11 10:50:17 -04:00
2014-09-18 10:54:36 +02:00
2015-03-04 00:23:23 -05:00
2015-03-03 14:44:41 -05:00
2015-02-24 16:05:48 -05:00
2014-11-10 13:27:49 -05:00
2015-05-11 10:59:32 -04:00
2015-05-11 10:59:32 -04:00
2014-01-13 17:39:11 +01:00
2015-05-26 15:21:27 +02:00
2015-05-27 19:29:42 +02:00
2015-05-17 13:08:29 -04:00
2015-02-11 14:46:37 -05:00
2014-02-08 10:36:58 -05:00
2015-05-13 14:31:43 -04:00
2015-04-09 00:02:26 -04:00
2014-02-09 17:32:50 -08:00
2013-12-06 12:37:56 -05:00
2015-03-06 21:50:02 -05:00
2013-12-10 21:50:00 -05:00
2013-09-20 14:49:32 -04:00
2015-04-07 15:25:55 -04:00
2013-09-20 14:49:32 -04:00
2014-02-09 17:32:49 -08:00
2014-02-09 17:32:49 -08:00
2015-03-29 13:23:54 -07:00
2013-01-09 23:59:53 -08:00
2015-03-09 16:06:10 -04:00
2015-05-12 23:19:49 -04:00
2013-11-07 19:28:58 -05:00
2014-02-04 20:19:51 -08:00
2015-03-12 14:39:40 -04:00
2013-03-26 12:32:13 -04:00
2015-06-04 15:44:31 -07:00
2014-04-16 15:05:11 -04:00
2014-02-12 07:02:11 +01:00
2014-11-12 15:01:35 -05:00
2013-09-20 14:49:33 -04:00
2014-09-30 01:02:26 -04:00
2015-03-12 14:39:40 -04:00
2015-05-13 15:59:13 -04:00
2014-06-04 22:46:38 -07:00
2015-01-18 01:56:32 -05:00
2014-11-05 16:30:03 -05:00
2013-09-20 14:49:33 -04:00
2014-02-06 09:34:58 +01:00
2015-06-12 11:42:29 +02:00
2015-03-23 22:12:09 -04:00
2015-03-20 12:40:25 -04:00
2015-03-18 22:00:35 -04:00
2015-05-11 10:50:18 -04:00
2015-05-31 21:49:14 -07:00
2014-05-07 15:30:52 -04:00
2015-05-27 13:03:31 -04:00
2015-05-26 19:48:46 -04:00
2015-06-06 23:57:12 -07:00
2015-04-13 16:40:05 -04:00
2015-03-31 13:58:35 -04:00
2014-08-24 18:09:23 -07:00
2015-05-25 13:25:35 -04:00
2015-05-25 13:25:34 -04:00
2015-04-07 15:29:08 -04:00
2015-03-11 16:22:14 -04:00
2015-04-02 14:05:00 -04:00
2015-03-12 14:39:40 -04:00
2015-06-04 15:44:30 -07:00
2015-06-04 15:44:30 -07:00
2014-11-24 04:28:49 -05:00
2015-02-28 21:31:12 +01:00
2013-09-21 14:01:38 -04:00
2014-10-14 02:18:27 +02:00
2013-09-21 14:01:38 -04:00
2013-09-21 14:01:38 -04:00
2014-12-10 15:21:24 -05:00
2015-05-11 10:50:17 -04:00
2013-09-21 14:01:38 -04:00
2014-01-01 22:22:43 -05:00
2013-09-21 14:01:38 -04:00
2013-09-21 14:01:38 -04:00
2014-12-10 15:21:24 -05:00
2013-09-21 14:01:38 -04:00
2014-01-03 20:56:48 -05:00
2015-06-10 16:05:36 +02:00
2015-06-12 11:43:58 +02:00
2013-12-06 12:37:56 -05:00
2014-09-22 16:23:15 -04:00
2014-11-05 23:52:33 -08:00
2013-10-01 17:06:14 -04:00
2015-03-04 00:23:23 -05:00
2015-03-20 21:47:40 -04:00
2015-06-18 21:14:29 +02:00
2013-09-21 14:01:39 -04:00
2014-08-07 20:55:21 -04:00
2015-03-31 13:58:35 -04:00
2014-02-08 10:36:58 -05:00
2013-09-21 14:01:39 -04:00
2015-06-10 12:24:33 +02:00
2013-09-21 14:01:39 -04:00
2015-03-02 13:06:31 -05:00
2014-10-06 18:02:32 -04:00
2015-01-13 17:51:08 -05:00
2014-05-23 16:28:53 -04:00
2013-09-23 01:51:08 -04:00
2013-09-23 01:51:08 -04:00
2013-09-23 01:51:08 -04:00
2014-01-21 23:17:20 -08:00
2014-12-17 11:49:55 +01:00
2015-05-05 16:02:34 -04:00
2013-09-23 01:51:08 -04:00
2015-01-15 18:26:16 -05:00
2015-04-10 12:42:40 -07:00
2015-05-13 15:08:14 -04:00
2013-09-23 01:51:09 -04:00
2014-06-02 11:00:41 -07:00
2014-10-15 07:48:18 +02:00
2015-06-21 10:00:07 -07:00
2013-12-19 18:51:20 -05:00
2013-09-23 01:51:09 -04:00
2015-05-17 22:49:09 -04:00
2013-10-21 18:43:02 -04:00
2015-03-12 22:58:12 -04:00
2015-06-11 16:33:11 -07:00
2014-01-19 19:53:18 -08:00
2014-05-22 14:57:15 -04:00
2015-04-07 15:29:08 -04:00
2015-03-02 13:06:31 -05:00
2015-02-04 01:34:15 -05:00
2013-07-27 22:14:06 -07:00
2015-04-07 15:29:08 -04:00
2013-09-23 16:29:40 -04:00
2014-09-05 17:35:28 -07:00
2013-09-23 16:29:41 -04:00
2015-04-07 15:25:55 -04:00