summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorIdo Schimmel <idosch@nvidia.com>2021-01-07 17:48:21 +0300
committerJakub Kicinski <kuba@kernel.org>2021-01-08 05:47:18 +0300
commit07e61a979ca4dddb3661f59328b3cd109f6b0070 (patch)
treec10b02e6faaae21b4ff301d91dd2a7eb126d2c5f /net
parentac7996d680d8b4a51bb99bbdcee3dc838b985498 (diff)
downloadlinux-07e61a979ca4dddb3661f59328b3cd109f6b0070.tar.xz
nexthop: Fix off-by-one error in error path
A reference was not taken for the current nexthop entry, so do not try to put it in the error path. Fixes: 430a049190de ("nexthop: Add support for nexthop groups") Signed-off-by: Ido Schimmel <idosch@nvidia.com> Reviewed-by: Petr Machata <petrm@nvidia.com> Reviewed-by: David Ahern <dsahern@kernel.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/nexthop.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ipv4/nexthop.c b/net/ipv4/nexthop.c
index 5e1b22d4f939..f8035cfa9c20 100644
--- a/net/ipv4/nexthop.c
+++ b/net/ipv4/nexthop.c
@@ -1459,7 +1459,7 @@ static struct nexthop *nexthop_create_group(struct net *net,
return nh;
out_no_nh:
- for (; i >= 0; --i)
+ for (i--; i >= 0; --i)
nexthop_put(nhg->nh_entries[i].nh);
kfree(nhg->spare);