diff options
author | Ido Schimmel <idosch@nvidia.com> | 2021-01-07 16:48:21 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-01-17 14:16:57 +0100 |
commit | 6486bc0a3400f2d67c0577fe8ddd792924b6614a (patch) | |
tree | 503f7219a3520c4b3b165dd71fb641b1d0b15ea3 /net/ipv4 | |
parent | 2e7635299fbf20f517e5516e5d84abbd1f4a2c49 (diff) | |
download | linux-rt-6486bc0a3400f2d67c0577fe8ddd792924b6614a.tar.gz |
nexthop: Fix off-by-one error in error path
[ Upstream commit 07e61a979ca4dddb3661f59328b3cd109f6b0070 ]
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/ipv4')
-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 0dc43ad28eb9..2f0fed9abf43 100644 --- a/net/ipv4/nexthop.c +++ b/net/ipv4/nexthop.c @@ -1277,7 +1277,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); |