diff options
-rw-r--r-- | net/netfilter/nfnetlink_log.c | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c index 2002d579c3ba..a5b9680a1821 100644 --- a/net/netfilter/nfnetlink_log.c +++ b/net/netfilter/nfnetlink_log.c | |||
@@ -825,6 +825,7 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb, | |||
825 | struct net *net = sock_net(ctnl); | 825 | struct net *net = sock_net(ctnl); |
826 | struct nfnl_log_net *log = nfnl_log_pernet(net); | 826 | struct nfnl_log_net *log = nfnl_log_pernet(net); |
827 | int ret = 0; | 827 | int ret = 0; |
828 | u16 flags; | ||
828 | 829 | ||
829 | if (nfula[NFULA_CFG_CMD]) { | 830 | if (nfula[NFULA_CFG_CMD]) { |
830 | u_int8_t pf = nfmsg->nfgen_family; | 831 | u_int8_t pf = nfmsg->nfgen_family; |
@@ -846,6 +847,28 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb, | |||
846 | goto out_put; | 847 | goto out_put; |
847 | } | 848 | } |
848 | 849 | ||
850 | /* Check if we support these flags in first place, dependencies should | ||
851 | * be there too not to break atomicity. | ||
852 | */ | ||
853 | if (nfula[NFULA_CFG_FLAGS]) { | ||
854 | flags = ntohs(nla_get_be16(nfula[NFULA_CFG_FLAGS])); | ||
855 | |||
856 | if ((flags & NFULNL_CFG_F_CONNTRACK) && | ||
857 | !rcu_access_pointer(nfnl_ct_hook)) { | ||
858 | #ifdef CONFIG_MODULES | ||
859 | nfnl_unlock(NFNL_SUBSYS_ULOG); | ||
860 | request_module("ip_conntrack_netlink"); | ||
861 | nfnl_lock(NFNL_SUBSYS_ULOG); | ||
862 | if (rcu_access_pointer(nfnl_ct_hook)) { | ||
863 | ret = -EAGAIN; | ||
864 | goto out_put; | ||
865 | } | ||
866 | #endif | ||
867 | ret = -EOPNOTSUPP; | ||
868 | goto out_put; | ||
869 | } | ||
870 | } | ||
871 | |||
849 | if (cmd != NULL) { | 872 | if (cmd != NULL) { |
850 | switch (cmd->command) { | 873 | switch (cmd->command) { |
851 | case NFULNL_CFG_CMD_BIND: | 874 | case NFULNL_CFG_CMD_BIND: |
@@ -905,26 +928,8 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb, | |||
905 | nfulnl_set_qthresh(inst, ntohl(qthresh)); | 928 | nfulnl_set_qthresh(inst, ntohl(qthresh)); |
906 | } | 929 | } |
907 | 930 | ||
908 | if (nfula[NFULA_CFG_FLAGS]) { | 931 | if (nfula[NFULA_CFG_FLAGS]) |
909 | u16 flags = ntohs(nla_get_be16(nfula[NFULA_CFG_FLAGS])); | ||
910 | |||
911 | if (flags & NFULNL_CFG_F_CONNTRACK && | ||
912 | !rcu_access_pointer(nfnl_ct_hook)) { | ||
913 | #ifdef CONFIG_MODULES | ||
914 | nfnl_unlock(NFNL_SUBSYS_ULOG); | ||
915 | request_module("ip_conntrack_netlink"); | ||
916 | nfnl_lock(NFNL_SUBSYS_ULOG); | ||
917 | if (rcu_access_pointer(nfnl_ct_hook)) { | ||
918 | ret = -EAGAIN; | ||
919 | goto out; | ||
920 | } | ||
921 | #endif | ||
922 | ret = -EOPNOTSUPP; | ||
923 | goto out; | ||
924 | } | ||
925 | |||
926 | nfulnl_set_flags(inst, flags); | 932 | nfulnl_set_flags(inst, flags); |
927 | } | ||
928 | 933 | ||
929 | out_put: | 934 | out_put: |
930 | instance_put(inst); | 935 | instance_put(inst); |