]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
tools/net/ynl: ethtool: fix crash when Hardware Clock info is missing
authorHangbin Liu <liuhangbin@gmail.com>
Thu, 8 May 2025 03:54:14 +0000 (03:54 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 22 May 2025 12:12:16 +0000 (14:12 +0200)
commit7777ca11a40bb9041db3e6f5800d89f855e5f482
tree9e9cae53eff825cbabaf5bc8984a41f3a502a953
parent95a9e08ea5bbd48b3bcf6fb64bc0aef07fd2aa40
tools/net/ynl: ethtool: fix crash when Hardware Clock info is missing

[ Upstream commit 45375814eb3f4245956c0c85092a4eee4441d167 ]

Fix a crash in the ethtool YNL implementation when Hardware Clock information
is not present in the response. This ensures graceful handling of devices or
drivers that do not provide this optional field. e.g.

  Traceback (most recent call last):
    File "/net/tools/net/ynl/pyynl/./ethtool.py", line 438, in <module>
      main()
      ~~~~^^
    File "/net/tools/net/ynl/pyynl/./ethtool.py", line 341, in main
      print(f'PTP Hardware Clock: {tsinfo["phc-index"]}')
                                   ~~~~~~^^^^^^^^^^^^^
  KeyError: 'phc-index'

Fixes: f3d07b02b2b8 ("tools: ynl: ethtool testing tool")
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Acked-by: Stanislav Fomichev <sdf@fomichev.me>
Link: https://patch.msgid.link/20250508035414.82974-1-liuhangbin@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/net/ynl/ethtool.py