summaryrefslogtreecommitdiffstats
path: root/net/ipv4/af_inet.c
diff options
context:
space:
mode:
authorEric Paris <eparis@redhat.com>2009-11-06 05:45:52 +0100
committerDavid S. Miller <davem@davemloft.net>2009-11-06 07:18:18 +0100
commitc84b3268da3b85c9d8a9e504e1001a14ed829e94 (patch)
tree795b4997f5610cf2e56a57ee5b1e4c2d4ca10188 /net/ipv4/af_inet.c
parentnet: pass kern to net_proto_family create function (diff)
downloadlinux-c84b3268da3b85c9d8a9e504e1001a14ed829e94.tar.xz
linux-c84b3268da3b85c9d8a9e504e1001a14ed829e94.zip
net: check kern before calling security subsystem
Before calling capable(CAP_NET_RAW) check if this operations is on behalf of the kernel or on behalf of userspace. Do not do the security check if it is on behalf of the kernel. Signed-off-by: Eric Paris <eparis@redhat.com> Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/af_inet.c')
-rw-r--r--net/ipv4/af_inet.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 5c7e42c02afb..7d12c6a9b19b 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -326,7 +326,7 @@ lookup_protocol:
}
err = -EPERM;
- if (sock->type == SOCK_RAW && !capable(CAP_NET_RAW))
+ if (sock->type == SOCK_RAW && !kern && !capable(CAP_NET_RAW))
goto out_rcu_unlock;
err = -EAFNOSUPPORT;