From db972e5325183df1265bf851b32dc7530dd4393a Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Wed, 7 Oct 2020 12:53:50 +0200 Subject: ethtool: strset: allow ETHTOOL_A_STRSET_COUNTS_ONLY attr The ETHTOOL_A_STRSET_COUNTS_ONLY flag attribute was previously not allowed to be used, but now due to the policy size reduction we would access the tb[] array out of bounds since we tried to check for the attribute despite it not being accepted. Fix both issues by adding it correctly to the appropriate policy. Fixes: ff419afa4310 ("ethtool: trim policy tables") Fixes: 71921690f974 ("ethtool: provide string sets with STRSET_GET request") Reported-by: Leon Romanovsky Signed-off-by: Johannes Berg Tested-by: Leon Romanovsky Reviewed-by: Jakub Kicinski Signed-off-by: Jakub Kicinski --- net/ethtool/strset.c | 1 + 1 file changed, 1 insertion(+) (limited to 'net/ethtool/strset.c') diff --git a/net/ethtool/strset.c b/net/ethtool/strset.c index 0734e83c674c..0baad0ce1832 100644 --- a/net/ethtool/strset.c +++ b/net/ethtool/strset.c @@ -103,6 +103,7 @@ const struct nla_policy ethnl_strset_get_policy[] = { [ETHTOOL_A_STRSET_HEADER] = NLA_POLICY_NESTED(ethnl_header_policy), [ETHTOOL_A_STRSET_STRINGSETS] = { .type = NLA_NESTED }, + [ETHTOOL_A_STRSET_COUNTS_ONLY] = { .type = NLA_FLAG }, }; static const struct nla_policy get_stringset_policy[] = { -- cgit v1.2.3