[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <01feb1f4bbd22a19f6629503c4f366aed6424567.1645020876.git.petrm@nvidia.com>
Date: Wed, 16 Feb 2022 15:31:36 +0100
From: Petr Machata <petrm@...dia.com>
To: <netdev@...r.kernel.org>
CC: "David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
David Ahern <dsahern@...nel.org>,
Petr Machata <petrm@...dia.com>,
"Ido Schimmel" <idosch@...dia.com>
Subject: [PATCH net-next] net: rtnetlink: rtnl_stats_get(): Emit an extack for unset filter_mask
Both get and dump handlers for RTM_GETSTATS require that a filter_mask, a
mask of which attributes should be emitted in the netlink response, is
unset. rtnl_stats_dump() does include an extack in the bounce,
rtnl_stats_get() however does not. Fix the omission.
Signed-off-by: Petr Machata <petrm@...dia.com>
Reviewed-by: Ido Schimmel <idosch@...dia.com>
---
net/core/rtnetlink.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index a6fad3df42a8..9aa7d8e0d90d 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -5405,8 +5405,10 @@ static int rtnl_stats_get(struct sk_buff *skb, struct nlmsghdr *nlh,
return -ENODEV;
filter_mask = ifsm->filter_mask;
- if (!filter_mask)
+ if (!filter_mask) {
+ NL_SET_ERR_MSG(extack, "Filter mask must be set for stats get");
return -EINVAL;
+ }
nskb = nlmsg_new(if_nlmsg_stats_size(dev, filter_mask), GFP_KERNEL);
if (!nskb)
--
2.31.1
Powered by blists - more mailing lists