netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: rtnetlink: rtnl_stats_get(): Emit an extack for unset filter_mask
@ 2022-02-16 14:31 Petr Machata
  2022-02-16 15:10 ` David Ahern
  2022-02-17  5:20 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Petr Machata @ 2022-02-16 14:31 UTC (permalink / raw)
  To: netdev
  Cc: David S. Miller, Jakub Kicinski, David Ahern, Petr Machata, Ido Schimmel

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(-)

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: rtnetlink: rtnl_stats_get(): Emit an extack for unset filter_mask
  2022-02-16 14:31 [PATCH net-next] net: rtnetlink: rtnl_stats_get(): Emit an extack for unset filter_mask Petr Machata
@ 2022-02-16 15:10 ` David Ahern
  2022-02-17  5:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: David Ahern @ 2022-02-16 15:10 UTC (permalink / raw)
  To: Petr Machata, netdev; +Cc: David S. Miller, Jakub Kicinski, Ido Schimmel

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>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: rtnetlink: rtnl_stats_get(): Emit an extack for unset filter_mask
  2022-02-16 14:31 [PATCH net-next] net: rtnetlink: rtnl_stats_get(): Emit an extack for unset filter_mask Petr Machata
  2022-02-16 15:10 ` David Ahern
@ 2022-02-17  5:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-02-17  5:20 UTC (permalink / raw)
  To: Petr Machata; +Cc: netdev, davem, kuba, dsahern, idosch

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-02-17  5:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-16 14:31 [PATCH net-next] net: rtnetlink: rtnl_stats_get(): Emit an extack for unset filter_mask Petr Machata
2022-02-16 15:10 ` David Ahern
2022-02-17  5:20 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).