Skip to content

Commit d708342

Browse files
committed
Merge branch 'nexthop-various-fixes'
Ido Schimmel says: ==================== nexthop: Various fixes This series contains various fixes for the nexthop code. The bugs were uncovered during the development of resilient nexthop groups. Patches #1-#2 fix the error path of nexthop_create_group(). I was not able to trigger these bugs with current code, but it is possible with the upcoming resilient nexthop groups code which adds a user controllable memory allocation further in the function. Patch #3 fixes wrong validation of netlink attributes. Patch #4 fixes wrong invocation of mausezahn in a selftest. ==================== Link: https://lore.kernel.org/r/20210107144824.1135691-1-idosch@idosch.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 parents ac7996d + a5c9ca7 commit d708342

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

net/ipv4/nexthop.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ static int nh_check_attr_group(struct net *net, struct nlattr *tb[],
627627
for (i = NHA_GROUP_TYPE + 1; i < __NHA_MAX; ++i) {
628628
if (!tb[i])
629629
continue;
630-
if (tb[NHA_FDB])
630+
if (i == NHA_FDB)
631631
continue;
632632
NL_SET_ERR_MSG(extack,
633633
"No other attributes can be set in nexthop groups");
@@ -1459,8 +1459,10 @@ static struct nexthop *nexthop_create_group(struct net *net,
14591459
return nh;
14601460

14611461
out_no_nh:
1462-
for (; 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);

tools/testing/selftests/net/fib_nexthops.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,7 @@ ipv6_torture()
869869
pid3=$!
870870
ip netns exec me ping -f 2001:db8:101::2 >/dev/null 2>&1 &
871871
pid4=$!
872-
ip netns exec me mausezahn veth1 -B 2001:db8:101::2 -A 2001:db8:91::1 -c 0 -t tcp "dp=1-1023, flags=syn" >/dev/null 2>&1 &
872+
ip netns exec me mausezahn -6 veth1 -B 2001:db8:101::2 -A 2001:db8:91::1 -c 0 -t tcp "dp=1-1023, flags=syn" >/dev/null 2>&1 &
873873
pid5=$!
874874

875875
sleep 300

0 commit comments

Comments
 (0)