提交 40e4f26e 编写于 作者: F Flavio Leitner 提交者: Pablo Neira Ayuso

netfilter: xt_socket: check sk before checking for netns.

Only check for the network namespace if the socket is available.

Fixes: f5646501 ("netfilter: check if the socket netns is correct.")
Reported-by: NGuenter Roeck <linux@roeck-us.net>
Tested-by: NGuenter Roeck <linux@roeck-us.net>
Signed-off-by: NFlavio Leitner <fbl@redhat.com>
Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
上级 421c119f
......@@ -56,7 +56,7 @@ socket_match(const struct sk_buff *skb, struct xt_action_param *par,
struct sk_buff *pskb = (struct sk_buff *)skb;
struct sock *sk = skb->sk;
if (!net_eq(xt_net(par), sock_net(sk)))
if (sk && !net_eq(xt_net(par), sock_net(sk)))
sk = NULL;
if (!sk)
......@@ -117,7 +117,7 @@ socket_mt6_v1_v2_v3(const struct sk_buff *skb, struct xt_action_param *par)
struct sk_buff *pskb = (struct sk_buff *)skb;
struct sock *sk = skb->sk;
if (!net_eq(xt_net(par), sock_net(sk)))
if (sk && !net_eq(xt_net(par), sock_net(sk)))
sk = NULL;
if (!sk)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册