Skip to content

Commit

Permalink
nexthop: Fix off-by-one error in error path
Browse files Browse the repository at this point in the history
A reference was not taken for the current nexthop entry, so do not try
to put it in the error path.

Fixes: 430a049 ("nexthop: Add support for nexthop groups")
Signed-off-by: Ido Schimmel <[email protected]>
Reviewed-by: Petr Machata <[email protected]>
Reviewed-by: David Ahern <[email protected]>
Signed-off-by: Jakub Kicinski <[email protected]>
  • Loading branch information
idosch authored and kuba-moo committed Jan 8, 2021
1 parent ac7996d commit 07e61a9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/ipv4/nexthop.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 07e61a9

Please sign in to comment.