Taehee Yoo
2a61d8b883
netfilter: ipt_CLUSTERIP: fix sleep-in-atomic bug in clusterip_config_entry_put()
...
A proc_remove() can sleep. so that it can't be inside of spin_lock.
Hence proc_remove() is moved to outside of spin_lock. and it also
adds mutex to sync create and remove of proc entry(config->pde).
test commands:
SHELL#1
%while :; do iptables -A INPUT -p udp -i enp2s0 -d 192.168.1.100 \
--dport 9000 -j CLUSTERIP --new --hashmode sourceip \
--clustermac 01:00:5e:00:00:21 --total-nodes 3 --local-node 3; \
iptables -F; done
SHELL#2
%while :; do echo +1 > /proc/net/ipt_CLUSTERIP/192.168.1.100; \
echo -1 > /proc/net/ipt_CLUSTERIP/192.168.1.100; done
[ 2949.569864] BUG: sleeping function called from invalid context at kernel/sched/completion.c:99
[ 2949.579944] in_atomic(): 1, irqs_disabled(): 0, pid: 5472, name: iptables
[ 2949.587920] 1 lock held by iptables/5472:
[ 2949.592711] #0 : 000000008f0ebcf2 (&(&cn->lock)->rlock){+...}, at: refcount_dec_and_lock+0x24/0x50
[ 2949.603307] CPU: 1 PID: 5472 Comm: iptables Tainted: G W 4.19.0-rc5+ #16
[ 2949.604212] Hardware name: To be filled by O.E.M. To be filled by O.E.M./Aptio CRB, BIOS 5.6.5 07/08/2015
[ 2949.604212] Call Trace:
[ 2949.604212] dump_stack+0xc9/0x16b
[ 2949.604212] ? show_regs_print_info+0x5/0x5
[ 2949.604212] ___might_sleep+0x2eb/0x420
[ 2949.604212] ? set_rq_offline.part.87+0x140/0x140
[ 2949.604212] ? _rcu_barrier_trace+0x400/0x400
[ 2949.604212] wait_for_completion+0x94/0x710
[ 2949.604212] ? wait_for_completion_interruptible+0x780/0x780
[ 2949.604212] ? __kernel_text_address+0xe/0x30
[ 2949.604212] ? __lockdep_init_map+0x10e/0x5c0
[ 2949.604212] ? __lockdep_init_map+0x10e/0x5c0
[ 2949.604212] ? __init_waitqueue_head+0x86/0x130
[ 2949.604212] ? init_wait_entry+0x1a0/0x1a0
[ 2949.604212] proc_entry_rundown+0x208/0x270
[ 2949.604212] ? proc_reg_get_unmapped_area+0x370/0x370
[ 2949.604212] ? __lock_acquire+0x4500/0x4500
[ 2949.604212] ? complete+0x18/0x70
[ 2949.604212] remove_proc_subtree+0x143/0x2a0
[ 2949.708655] ? remove_proc_entry+0x390/0x390
[ 2949.708655] clusterip_tg_destroy+0x27a/0x630 [ipt_CLUSTERIP]
[ ... ]
Fixes: b3e456fce9f5 ("netfilter: ipt_CLUSTERIP: fix a race condition of proc file creation")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2018-12-18 01:18:24 +01:00
..
2018-07-06 12:32:12 +02:00
2018-11-03 10:35:52 -07:00
2018-11-08 20:45:04 -08:00
2018-06-28 10:40:47 -07:00
2018-10-23 10:57:06 -07:00
2018-07-24 14:10:42 -07:00
2018-09-25 10:35:29 -07:00
2018-11-01 19:58:52 -07:00
2018-10-19 13:49:34 -07:00
2018-10-22 19:37:36 -07:00
2018-11-08 20:45:04 -08:00
2018-10-23 10:57:06 -07:00
2018-06-28 10:40:47 -07:00
2018-11-01 19:58:52 -07:00
2018-11-11 17:57:54 -08:00
2018-07-27 13:17:50 -07:00
2018-11-08 17:13:08 -08:00
2018-09-21 19:48:36 -07:00
2018-10-04 09:40:52 -07:00
2018-10-22 19:49:04 -07:00
2018-06-26 11:33:04 +09:00
2018-09-21 19:45:52 -07:00
2018-12-18 01:18:24 +01:00
2018-12-17 23:33:31 +01:00
2018-11-10 16:55:11 -08:00
2018-09-17 18:43:42 -07:00
2018-07-27 09:33:37 -07:00
2018-08-13 20:45:49 -07:00
2018-10-22 19:59:20 -07:00
2018-10-12 13:05:40 +02:00
2018-09-28 12:46:07 +08:00
2018-10-16 00:14:07 -07:00
2018-10-17 22:14:54 -07:00
2018-12-18 00:08:53 +01:00
2018-09-21 18:58:34 -07:00
2018-10-16 00:13:12 -07:00
2018-06-28 10:40:47 -07:00
2018-10-24 14:43:41 +01:00
2018-07-12 16:55:29 -07:00
2018-11-10 13:42:16 -08:00
2018-10-06 14:43:42 -07:00
2018-06-28 10:40:47 -07:00
2018-07-05 20:20:03 +09:00
2018-10-12 21:38:46 -07:00
2018-09-04 21:33:03 -07:00
2018-06-28 10:40:47 -07:00
2018-11-02 23:59:26 -07:00
2018-11-11 17:57:54 -08:00
2018-11-10 19:32:23 -08:00
2018-11-01 19:58:52 -07:00
2018-10-15 12:23:19 -07:00
2018-11-04 08:20:09 -08:00
2018-11-11 17:57:54 -08:00
2018-11-01 19:58:52 -07:00
2018-10-23 10:57:06 -07:00
2018-08-07 12:39:13 -07:00
2018-07-24 14:10:42 -07:00
2018-10-12 12:56:34 +02:00
2018-07-24 14:10:42 -07:00
2018-10-19 11:03:06 -07:00
2018-11-03 18:25:17 -07:00
2018-08-29 15:42:24 +02:00
2018-10-15 12:23:19 -07:00
2018-06-28 13:36:39 +09:00
2018-11-01 19:58:52 -07:00