tools: ynl: avoid print_field when there is no reply
Subsystems (3)
PATCH 1/1 tools: ynl: avoid print_field when there is no reply
When request a none support device operation, there will be no reply. In this case, the len(desc) check will always be true, causing print_field to enter an infinite loop and crash the program. Example reproducer:
# ethtool.py -c veth0
To fix this, return immediately if there is no reply.
--- tools/net/ynl/pyynl/ethtool.py | 3 +++ 1 file changed, 3 insertions(+)
tools/net/ynl/pyynl/ethtool.py +3 -0
@@ -44,6 +44,9 @@ def print_field(reply, *desc): Pretty-print a set of fields from the reply. desc specifies the fields and the optional type (bool/yn). """ + if not reply: + return + if len(desc) == 0: return print_field(reply, *zip(reply.keys(), reply.keys()))
Signature · 1 line
2.50.1
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 9 lines · On Fri, 24 Oct 2025 12:58:53 +0000 you wrote:
When request a none support device operation, there will be no reply. In this case, the len(desc) check will always be true, causing
print_fieldto enter an infinite loop and crash the program. Example reproducer:# ethtool.py -c veth0To fix this, return immediately if there is no reply.
[...]
Here is the summary with links:
- [net] tools: ynl: avoid print_field when there is no reply
https://git.kernel.org/netdev/net/c/e3966940559d
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html