diff options
author | Ishan Mittal <imittal@nvidia.com> | 2014-05-15 18:21:20 +0530 |
---|---|---|
committer | Ishan Mittal <imittal@nvidia.com> | 2014-05-29 12:41:59 +0530 |
commit | 75c1032e7b6215de41e451a01033a342372105d4 (patch) | |
tree | 54fe571dd5a1c1e69f93c219e1cdf9c072e87d88 /net/ipv4 | |
parent | c436d07ff6b15f6540e7468c7c793ef15e55a921 (diff) | |
parent | c4db79235d21ba1dcd10d42154910ac1ba8e3ed3 (diff) |
Merge branch 'android-3.10' into rel-21
Bug 200004122
Bug 1511804
This merge takes AOSP commits from android-3.10 branch
Change-Id: I07ec2468114db0366d63777142c9572bbfadbc45
Signed-off-by: Ishan Mittal <imittal@nvidia.com>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/ping.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c index 5bf79864ca66..7122472d24a6 100644 --- a/net/ipv4/ping.c +++ b/net/ipv4/ping.c @@ -249,26 +249,33 @@ int ping_init_sock(struct sock *sk) { struct net *net = sock_net(sk); kgid_t group = current_egid(); - struct group_info *group_info = get_current_groups(); - int i, j, count = group_info->ngroups; + struct group_info *group_info; + int i, j, count; kgid_t low, high; + int ret = 0; inet_get_ping_group_range_net(net, &low, &high); if (gid_lte(low, group) && gid_lte(group, high)) return 0; + group_info = get_current_groups(); + count = group_info->ngroups; for (i = 0; i < group_info->nblocks; i++) { int cp_count = min_t(int, NGROUPS_PER_BLOCK, count); for (j = 0; j < cp_count; j++) { kgid_t gid = group_info->blocks[i][j]; if (gid_lte(low, gid) && gid_lte(gid, high)) - return 0; + goto out_release_group; } count -= cp_count; } - return -EACCES; + ret = -EACCES; + +out_release_group: + put_group_info(group_info); + return ret; } EXPORT_SYMBOL_GPL(ping_init_sock); |