Skip to content

Commit 7b01e53

Browse files
idoschkuba-moo
authored andcommitted
nexthop: Unlink nexthop group entry in error path
In case of error, remove the nexthop group entry from the list to which it was previously added. 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]>
1 parent 07e61a9 commit 7b01e53

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

net/ipv4/nexthop.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1459,8 +1459,10 @@ static struct nexthop *nexthop_create_group(struct net *net,
14591459
return nh;
14601460

14611461
out_no_nh:
1462-
for (i--; i >= 0; --i)
1462+
for (i--; i >= 0; --i) {
1463+
list_del(&nhg->nh_entries[i].nh_list);
14631464
nexthop_put(nhg->nh_entries[i].nh);
1465+
}
14641466

14651467
kfree(nhg->spare);
14661468
kfree(nhg);

0 commit comments

Comments
 (0)