Skip to content

Commit

Permalink
net: rtnetlink: rtnl_stats_get(): Emit an extack for unset filter_mask
Browse files Browse the repository at this point in the history
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@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Link: https://lore.kernel.org/r/01feb1f4bbd22a19f6629503c4f366aed6424567.1645020876.git.petrm@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Petr Machata authored and Jakub Kicinski committed Feb 17, 2022
1 parent 4d07847 commit 22b67d1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion net/core/rtnetlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 22b67d1

Please sign in to comment.