diff mbox series

[net] ethtool: don't propagate EOPNOTSUPP from dumps

Message ID 20231126225806.2143528-1-kuba@kernel.org (mailing list archive)
State Accepted
Commit cbeb989e41f4094f54bec2cecce993f26f547bea
Delegated to: Netdev Maintainers
Headers show
Series [net] ethtool: don't propagate EOPNOTSUPP from dumps | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/codegen success Generated files up to date
netdev/tree_selection success Clearly marked for net
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1117 this patch: 1117
netdev/cc_maintainers warning 1 maintainers not CCed: jiri@resnulli.us
netdev/build_clang success Errors and warnings before: 1143 this patch: 1143
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 1144 this patch: 1144
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 7 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Jakub Kicinski Nov. 26, 2023, 10:58 p.m. UTC
The default dump handler needs to clear ret before returning.
Otherwise if the last interface returns an inconsequential
error this error will propagate to user space.

This may confuse user space (ethtool CLI seems to ignore it,
but YNL doesn't). It will also terminate the dump early
for mutli-skb dump, because netlink core treats EOPNOTSUPP
as a real error.

Fixes: 728480f12442 ("ethtool: default handlers for GET requests")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: f.fainelli@gmail.com
CC: mkubecek@suse.cz
---
 net/ethtool/netlink.c | 1 +
 1 file changed, 1 insertion(+)

Comments

'Simon Horman' Nov. 28, 2023, 5:48 p.m. UTC | #1
On Sun, Nov 26, 2023 at 02:58:06PM -0800, Jakub Kicinski wrote:
> The default dump handler needs to clear ret before returning.
> Otherwise if the last interface returns an inconsequential
> error this error will propagate to user space.
> 
> This may confuse user space (ethtool CLI seems to ignore it,
> but YNL doesn't). It will also terminate the dump early
> for mutli-skb dump, because netlink core treats EOPNOTSUPP
> as a real error.
> 
> Fixes: 728480f12442 ("ethtool: default handlers for GET requests")
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Reviewed-by: Simon Horman <horms@kernel.org>
patchwork-bot+netdevbpf@kernel.org Nov. 29, 2023, 4:50 p.m. UTC | #2
Hello:

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

On Sun, 26 Nov 2023 14:58:06 -0800 you wrote:
> The default dump handler needs to clear ret before returning.
> Otherwise if the last interface returns an inconsequential
> error this error will propagate to user space.
> 
> This may confuse user space (ethtool CLI seems to ignore it,
> but YNL doesn't). It will also terminate the dump early
> for mutli-skb dump, because netlink core treats EOPNOTSUPP
> as a real error.
> 
> [...]

Here is the summary with links:
  - [net] ethtool: don't propagate EOPNOTSUPP from dumps
    https://git.kernel.org/netdev/net/c/cbeb989e41f4

You are awesome, thank you!
diff mbox series

Patch

diff --git a/net/ethtool/netlink.c b/net/ethtool/netlink.c
index 3bbd5afb7b31..fe3553f60bf3 100644
--- a/net/ethtool/netlink.c
+++ b/net/ethtool/netlink.c
@@ -505,6 +505,7 @@  static int ethnl_default_dumpit(struct sk_buff *skb,
 				ret = skb->len;
 			break;
 		}
+		ret = 0;
 	}
 	rtnl_unlock();