: complain when broken ipt_owner options are used on SMP
Subsystems (2)
PATCH 2/14 : complain when broken ipt_owner options are used on SMP
This patch for 2.6 makes ipt_owner and ip6t_owner complain when options that are broken on SMP are used. When the pid, sid or command is matched the owner match takes files->file_lock in a BH, which deadlocks on SMP.
Author: Patrick McHardy <[email protected]>
Signed-off-by Patrick McHardy <[email protected]>
Signed-off-by Harald Welte <[email protected]>
# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2004/06/20 22:28:01+02:00 [email protected]
# [NETFILTER]: complain about brokeness on SMP for pid, sid and command matching in ipt_owner
#
# net/ipv6/netfilter/ip6t_owner.c # 2004/06/20 22:27:51+02:00 [email protected] +8 -1 # [NETFILTER]: complain about brokeness on SMP for pid, sid and command matching in ipt_owner # # net/ipv4/netfilter/ipt_owner.c # 2004/06/20 22:27:51+02:00 [email protected] +9 -1 # [NETFILTER]: complain about brokeness on SMP for pid, sid and command matching in ipt_owner # diff -Nru a/net/ipv4/netfilter/ipt_owner.c b/net/ipv4/netfilter/ipt_owner.c --- a/net/ipv4/netfilter/ipt_owner.c 2004-06-20 22:59:31 +02:00 +++ b/net/ipv4/netfilter/ipt_owner.c 2004-06-20 22:59:31 +02:00 @@ -184,7 +184,15 @@ IPT_ALIGN(sizeof(struct ipt_owner_info))); return 0; } - +#ifdef CONFIG_SMP + /* files->file_lock can not be used in a BH */ + if (((struct ipt_owner_info *)matchinfo)->match + & (IPT_OWNER_PID|IPT_OWNER_SID|IPT_OWNER_COMM)) { + printk("ipt_owner: pid, sid and command matching is broken " + "on SMP.\n"); + return 0; + } +#endif return 1; }
net/ipv6/netfilter/ip6t_owner.c +8 -1
@@ -143,7 +143,14 @@if (matchsize !=IP6T_ALIGN (sizeof (struct ip6t_owner_info )))return 0 ; - +#ifdef CONFIG_SMP +/* files->file_lock can not be used in a BH */ +if (((struct ip6t_owner_info *)matchinfo)->match + & (IP6T_OWNER_PID |IP6T_OWNER_SID )) { +printk ("ip6t_owner: pid and sid matching is broken on SMP.\n" ); +return 0 ; + } +#endif return 1 ; }