netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] tools: ynl: avoid print_field when there is no reply
@ 2025-10-24 12:58 Hangbin Liu
  2025-10-28  1:30 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Hangbin Liu @ 2025-10-24 12:58 UTC (permalink / raw)
  To: netdev
  Cc: Donald Hunter, Jakub Kicinski, David S. Miller, Eric Dumazet,
	Paolo Abeni, Simon Horman, Jan Stancek, Matthieu Baerts (NGI0),
	Asbjørn Sloth Tønnesen, Stanislav Fomichev, Hangbin Liu

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.

Fixes: f3d07b02b2b8 ("tools: ynl: ethtool testing tool")
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
---
 tools/net/ynl/pyynl/ethtool.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/net/ynl/pyynl/ethtool.py b/tools/net/ynl/pyynl/ethtool.py
index 9b523cbb3568..fd0f6b8d54d1 100755
--- a/tools/net/ynl/pyynl/ethtool.py
+++ b/tools/net/ynl/pyynl/ethtool.py
@@ -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()))
 
-- 
2.50.1


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

* Re: [PATCH net] tools: ynl: avoid print_field when there is no reply
  2025-10-24 12:58 [PATCH net] tools: ynl: avoid print_field when there is no reply Hangbin Liu
@ 2025-10-28  1:30 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-10-28  1:30 UTC (permalink / raw)
  To: Hangbin Liu
  Cc: netdev, donald.hunter, kuba, davem, edumazet, pabeni, horms,
	jstancek, matttbe, ast, sdf

Hello:

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

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_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.
> 
> [...]

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



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

end of thread, other threads:[~2025-10-28  1:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-24 12:58 [PATCH net] tools: ynl: avoid print_field when there is no reply Hangbin Liu
2025-10-28  1:30 ` 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).