diff mbox series

[net-next] net: rtnetlink: rtnl_stats_get(): Emit an extack for unset filter_mask

Message ID 01feb1f4bbd22a19f6629503c4f366aed6424567.1645020876.git.petrm@nvidia.com (mailing list archive)
State Accepted
Commit 22b67d17194fa47ac06b27475e63bb9f7f65b307
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: rtnetlink: rtnl_stats_get(): Emit an extack for unset filter_mask | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 2 this patch: 2
netdev/cc_maintainers success CCed 3 of 3 maintainers
netdev/build_clang success Errors and warnings before: 18 this patch: 18
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 7 this patch: 7
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 11 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Petr Machata Feb. 16, 2022, 2:31 p.m. UTC
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>
---
 net/core/rtnetlink.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

David Ahern Feb. 16, 2022, 3:10 p.m. UTC | #1
On 2/16/22 7:31 AM, Petr Machata wrote:
> 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>
> ---
>  net/core/rtnetlink.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 

Reviewed-by: David Ahern <dsahern@kernel.org>
patchwork-bot+netdevbpf@kernel.org Feb. 17, 2022, 5:20 a.m. UTC | #2
Hello:

This patch was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Wed, 16 Feb 2022 15:31:36 +0100 you wrote:
> 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>
> 
> [...]

Here is the summary with links:
  - [net-next] net: rtnetlink: rtnl_stats_get(): Emit an extack for unset filter_mask
    https://git.kernel.org/netdev/net-next/c/22b67d17194f

You are awesome, thank you!
diff mbox series

Patch

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)