diff options
author | Ido Schimmel <idosch@nvidia.com> | 2021-01-07 15:48:21 +0100 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2021-01-08 03:47:18 +0100 |
commit | 07e61a979ca4dddb3661f59328b3cd109f6b0070 (patch) | |
tree | c10b02e6faaae21b4ff301d91dd2a7eb126d2c5f /net/ipv4/nexthop.c | |
parent | octeontx2-af: fix memory leak of lmac and lmac->name (diff) | |
download | linux-07e61a979ca4dddb3661f59328b3cd109f6b0070.tar.xz linux-07e61a979ca4dddb3661f59328b3cd109f6b0070.zip |
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 '')
-rw-r--r-- | net/ipv4/nexthop.c | 2 |
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); |