diff options
-rw-r--r-- | net/netfilter/nf_sockopt.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/net/netfilter/nf_sockopt.c b/net/netfilter/nf_sockopt.c index e32761ce260c..aa2831587b82 100644 --- a/net/netfilter/nf_sockopt.c +++ b/net/netfilter/nf_sockopt.c | |||
@@ -69,6 +69,9 @@ static int nf_sockopt(struct sock *sk, int pf, int val, | |||
69 | struct nf_sockopt_ops *ops; | 69 | struct nf_sockopt_ops *ops; |
70 | int ret; | 70 | int ret; |
71 | 71 | ||
72 | if (sk->sk_net != &init_net) | ||
73 | return -ENOPROTOOPT; | ||
74 | |||
72 | if (mutex_lock_interruptible(&nf_sockopt_mutex) != 0) | 75 | if (mutex_lock_interruptible(&nf_sockopt_mutex) != 0) |
73 | return -EINTR; | 76 | return -EINTR; |
74 | 77 | ||
@@ -125,6 +128,10 @@ static int compat_nf_sockopt(struct sock *sk, int pf, int val, | |||
125 | struct nf_sockopt_ops *ops; | 128 | struct nf_sockopt_ops *ops; |
126 | int ret; | 129 | int ret; |
127 | 130 | ||
131 | if (sk->sk_net != &init_net) | ||
132 | return -ENOPROTOOPT; | ||
133 | |||
134 | |||
128 | if (mutex_lock_interruptible(&nf_sockopt_mutex) != 0) | 135 | if (mutex_lock_interruptible(&nf_sockopt_mutex) != 0) |
129 | return -EINTR; | 136 | return -EINTR; |
130 | 137 | ||