]> www.infradead.org Git - users/hch/configfs.git/commitdiff
net: team: fix incorrect maxattr
authorHangbin Liu <liuhangbin@gmail.com>
Tue, 9 Apr 2024 09:28:12 +0000 (17:28 +0800)
committerJakub Kicinski <kuba@kernel.org>
Thu, 11 Apr 2024 02:36:23 +0000 (19:36 -0700)
The maxattr should be the latest attr value, i.e. array size - 1,
not total array size.

Reported-by: syzbot+ecd7e07b4be038658c9f@syzkaller.appspotmail.com
Fixes: 948dbafc15da ("net: team: use policy generated by YAML spec")
Suggested-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Link: https://lore.kernel.org/r/20240409092812.3999785-1-liuhangbin@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/team/team_core.c

index 4e3c8d40495711424a15d83a6cb029b24a4d5ee2..8c7dbaf7c22ebb720f81ac087e8ec51e59803915 100644 (file)
@@ -2808,7 +2808,7 @@ static const struct genl_multicast_group team_nl_mcgrps[] = {
 static struct genl_family team_nl_family __ro_after_init = {
        .name           = TEAM_GENL_NAME,
        .version        = TEAM_GENL_VERSION,
-       .maxattr        = ARRAY_SIZE(team_nl_policy),
+       .maxattr        = ARRAY_SIZE(team_nl_policy) - 1,
        .policy = team_nl_policy,
        .netnsok        = true,
        .module         = THIS_MODULE,