Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 352050
b: refs/heads/master
c: bb12b8b
h: refs/heads/master
v: v3
  • Loading branch information
Gao feng authored and David S. Miller committed Feb 4, 2013
1 parent 27137e8 commit 4de4337
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c5c351088ae76b46ae08dec1bb7f621e0721c78b
refs/heads/master: bb12b8b26e197b21e3f28d5401bfee6f86a8d633
24 changes: 14 additions & 10 deletions trunk/net/bridge/netfilter/ebtables.c
Original file line number Diff line number Diff line change
Expand Up @@ -1472,16 +1472,17 @@ static int do_ebt_set_ctl(struct sock *sk,
int cmd, void __user *user, unsigned int len)
{
int ret;
struct net *net = sock_net(sk);

if (!capable(CAP_NET_ADMIN))
if (!ns_capable(net->user_ns, CAP_NET_ADMIN))
return -EPERM;

switch(cmd) {
case EBT_SO_SET_ENTRIES:
ret = do_replace(sock_net(sk), user, len);
ret = do_replace(net, user, len);
break;
case EBT_SO_SET_COUNTERS:
ret = update_counters(sock_net(sk), user, len);
ret = update_counters(net, user, len);
break;
default:
ret = -EINVAL;
Expand All @@ -1494,14 +1495,15 @@ static int do_ebt_get_ctl(struct sock *sk, int cmd, void __user *user, int *len)
int ret;
struct ebt_replace tmp;
struct ebt_table *t;
struct net *net = sock_net(sk);

if (!capable(CAP_NET_ADMIN))
if (!ns_capable(net->user_ns, CAP_NET_ADMIN))
return -EPERM;

if (copy_from_user(&tmp, user, sizeof(tmp)))
return -EFAULT;

t = find_table_lock(sock_net(sk), tmp.name, &ret, &ebt_mutex);
t = find_table_lock(net, tmp.name, &ret, &ebt_mutex);
if (!t)
return ret;

Expand Down Expand Up @@ -2279,16 +2281,17 @@ static int compat_do_ebt_set_ctl(struct sock *sk,
int cmd, void __user *user, unsigned int len)
{
int ret;
struct net *net = sock_net(sk);

if (!capable(CAP_NET_ADMIN))
if (!ns_capable(net->user_ns, CAP_NET_ADMIN))
return -EPERM;

switch (cmd) {
case EBT_SO_SET_ENTRIES:
ret = compat_do_replace(sock_net(sk), user, len);
ret = compat_do_replace(net, user, len);
break;
case EBT_SO_SET_COUNTERS:
ret = compat_update_counters(sock_net(sk), user, len);
ret = compat_update_counters(net, user, len);
break;
default:
ret = -EINVAL;
Expand All @@ -2302,8 +2305,9 @@ static int compat_do_ebt_get_ctl(struct sock *sk, int cmd,
int ret;
struct compat_ebt_replace tmp;
struct ebt_table *t;
struct net *net = sock_net(sk);

if (!capable(CAP_NET_ADMIN))
if (!ns_capable(net->user_ns, CAP_NET_ADMIN))
return -EPERM;

/* try real handler in case userland supplied needed padding */
Expand All @@ -2314,7 +2318,7 @@ static int compat_do_ebt_get_ctl(struct sock *sk, int cmd,
if (copy_from_user(&tmp, user, sizeof(tmp)))
return -EFAULT;

t = find_table_lock(sock_net(sk), tmp.name, &ret, &ebt_mutex);
t = find_table_lock(net, tmp.name, &ret, &ebt_mutex);
if (!t)
return ret;

Expand Down

0 comments on commit 4de4337

Please sign in to comment.