Commit d7083427 authored by Jakub Kicinski's avatar Jakub Kicinski

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.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents ac7996d6 a5c9ca76
...@@ -627,7 +627,7 @@ static int nh_check_attr_group(struct net *net, struct nlattr *tb[], ...@@ -627,7 +627,7 @@ static int nh_check_attr_group(struct net *net, struct nlattr *tb[],
for (i = NHA_GROUP_TYPE + 1; i < __NHA_MAX; ++i) { for (i = NHA_GROUP_TYPE + 1; i < __NHA_MAX; ++i) {
if (!tb[i]) if (!tb[i])
continue; continue;
if (tb[NHA_FDB]) if (i == NHA_FDB)
continue; continue;
NL_SET_ERR_MSG(extack, NL_SET_ERR_MSG(extack,
"No other attributes can be set in nexthop groups"); "No other attributes can be set in nexthop groups");
...@@ -1459,8 +1459,10 @@ static struct nexthop *nexthop_create_group(struct net *net, ...@@ -1459,8 +1459,10 @@ static struct nexthop *nexthop_create_group(struct net *net,
return nh; return nh;
out_no_nh: out_no_nh:
for (; i >= 0; --i) for (i--; i >= 0; --i) {
list_del(&nhg->nh_entries[i].nh_list);
nexthop_put(nhg->nh_entries[i].nh); nexthop_put(nhg->nh_entries[i].nh);
}
kfree(nhg->spare); kfree(nhg->spare);
kfree(nhg); kfree(nhg);
......
...@@ -869,7 +869,7 @@ ipv6_torture() ...@@ -869,7 +869,7 @@ ipv6_torture()
pid3=$! pid3=$!
ip netns exec me ping -f 2001:db8:101::2 >/dev/null 2>&1 & ip netns exec me ping -f 2001:db8:101::2 >/dev/null 2>&1 &
pid4=$! pid4=$!
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 & 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 &
pid5=$! pid5=$!
sleep 300 sleep 300
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment