From: David Ahern Date: Sun, 17 May 2020 17:26:32 +0000 (-0600) Subject: nexthop: Fix attribute checking for groups X-Git-Tag: v5.6.16~157 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=29fa5cd052f7017cd6b204ef70b417bcf7d42c11;p=thirdparty%2Fkernel%2Fstable.git nexthop: Fix attribute checking for groups [ Upstream commit 84be69b869a5a496a6cfde9b3c29509207a1f1fa ] For nexthop groups, attributes after NHA_GROUP_TYPE are invalid, but nh_check_attr_group starts checking at NHA_GROUP. The group type defaults to multipath and the NHA_GROUP_TYPE is currently optional so this has slipped through so far. Fix the attribute checking to handle support of new group types. Fixes: 430a049190de ("nexthop: Add support for nexthop groups") Signed-off-by: ASSOGBA Emery Signed-off-by: David Ahern Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- diff --git a/net/ipv4/nexthop.c b/net/ipv4/nexthop.c index 489c27f894d72..b03ea728d9a3e 100644 --- a/net/ipv4/nexthop.c +++ b/net/ipv4/nexthop.c @@ -434,7 +434,7 @@ static int nh_check_attr_group(struct net *net, struct nlattr *tb[], if (!valid_group_nh(nh, len, extack)) return -EINVAL; } - for (i = NHA_GROUP + 1; i < __NHA_MAX; ++i) { + for (i = NHA_GROUP_TYPE + 1; i < __NHA_MAX; ++i) { if (!tb[i]) continue;