Commit 332b8bee authored by Herbert Xu's avatar Herbert Xu Committed by Chris Wright

[PATCH] Restrict socket policy loading to CAP_NET_ADMIN - CAN-2005-2555

The interface needs much redesigning if we wish to allow
normal users to do this in some way.
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatar"David S. Miller" <davem@davemloft.net>
Signed-off-by: default avatarChris Wright <chrisw@osdl.org>
parent ab1e03b7
...@@ -848,6 +848,9 @@ int ip_setsockopt(struct sock *sk, int level, int optname, char __user *optval, ...@@ -848,6 +848,9 @@ int ip_setsockopt(struct sock *sk, int level, int optname, char __user *optval,
case IP_IPSEC_POLICY: case IP_IPSEC_POLICY:
case IP_XFRM_POLICY: case IP_XFRM_POLICY:
err = -EPERM;
if (!capable(CAP_NET_ADMIN))
break;
err = xfrm_user_policy(sk, optname, optval, optlen); err = xfrm_user_policy(sk, optname, optval, optlen);
break; break;
......
...@@ -503,6 +503,9 @@ int ipv6_setsockopt(struct sock *sk, int level, int optname, ...@@ -503,6 +503,9 @@ int ipv6_setsockopt(struct sock *sk, int level, int optname,
break; break;
case IPV6_IPSEC_POLICY: case IPV6_IPSEC_POLICY:
case IPV6_XFRM_POLICY: case IPV6_XFRM_POLICY:
retv = -EPERM;
if (!capable(CAP_NET_ADMIN))
break;
retv = xfrm_user_policy(sk, optname, optval, optlen); retv = xfrm_user_policy(sk, optname, optval, optlen);
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment