summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Kicinski <jakub.kicinski@netronome.com>2019-01-18 10:46:15 -0800
committerDavid S. Miller <davem@davemloft.net>2019-01-19 10:09:58 -0800
commit6300acb2eb560496e3560ba709c4f3ea042dadbc (patch)
tree97e07f46c23072c6c3db89c3ba05c05f03358a2d
parent51bc860d4a997139a3f12bedb96bbf0edcf22d51 (diff)
rtnetlink: stats: reject requests for unknown stats
In the spirit of strict checks reject requests of stats the kernel does not support when NETLINK_F_STRICT_CHK is set. Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/core/rtnetlink.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 03d0623eccae..2b4e61bcd420 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -4928,6 +4928,10 @@ static int rtnl_valid_stats_req(const struct nlmsghdr *nlh, bool strict_check,
NL_SET_ERR_MSG(extack, "Invalid attributes after stats header");
return -EINVAL;
}
+ if (ifsm->filter_mask >= IFLA_STATS_FILTER_BIT(IFLA_STATS_MAX + 1)) {
+ NL_SET_ERR_MSG(extack, "Invalid stats requested through filter mask");
+ return -EINVAL;
+ }
return 0;
}