aboutsummaryrefslogtreecommitdiff
path: root/net/ipv4/sysctl_net_ipv4.c
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2018-07-25 17:36:41 +0100
committerMark Brown <broonie@kernel.org>2018-07-25 17:36:41 +0100
commit7a9ad990a091b525e93a41b142cd3a06129a032d (patch)
tree7fb58a8fe566ddf75ffe68bec408219958031cd0 /net/ipv4/sysctl_net_ipv4.c
parent8371e272b158ce56b201bc530841a27320f94e7c (diff)
parent8c9257333713c1f185693fe0df2df79dfc1fa1c8 (diff)
Merge branch 'linux-linaro-lsk-v4.9' into linux-linaro-lsk-v4.9-rtlsk-v4.9-18.07-rt
Diffstat (limited to 'net/ipv4/sysctl_net_ipv4.c')
-rw-r--r--net/ipv4/sysctl_net_ipv4.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c
index 5f557f5d2b89..4756b75ce358 100644
--- a/net/ipv4/sysctl_net_ipv4.c
+++ b/net/ipv4/sysctl_net_ipv4.c
@@ -140,8 +140,9 @@ static int ipv4_ping_group_range(struct ctl_table *table, int write,
if (write && ret == 0) {
low = make_kgid(user_ns, urange[0]);
high = make_kgid(user_ns, urange[1]);
- if (!gid_valid(low) || !gid_valid(high) ||
- (urange[1] < urange[0]) || gid_lt(high, low)) {
+ if (!gid_valid(low) || !gid_valid(high))
+ return -EINVAL;
+ if (urange[1] < urange[0] || gid_lt(high, low)) {
low = make_kgid(&init_user_ns, 1);
high = make_kgid(&init_user_ns, 0);
}