Skip to content

Commit

Permalink
net: ethtool: tsinfo: Fix dump command
Browse files Browse the repository at this point in the history
Fix missing initialization of ts_info->phc_index in the dump command,
which could cause a netdev interface to incorrectly display a PTP provider
at index 0 instead of "none".
Fix it by initializing the phc_index to -1.

In the same time, restore missing initialization of ts_info.cmd for the
IOCTL case, as it was before the transition from ethnl_default_dumpit to
custom ethnl_tsinfo_dumpit.

Also, remove unnecessary zeroing of ts_info, as it is embedded within
reply_data, which is fully zeroed two lines earlier.

Fixes: b9e3f7d ("net: ethtool: tsinfo: Enhance tsinfo to support several hwtstamp by net topology")
Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
Link: https://patch.msgid.link/20250307091255.463559-1-kory.maincent@bootlin.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Kory Maincent authored and Jakub Kicinski committed Mar 10, 2025
1 parent eab0396 commit d0a4a1b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/ethtool/tsinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,8 @@ static void *ethnl_tsinfo_prepare_dump(struct sk_buff *skb,
reply_data = ctx->reply_data;
memset(reply_data, 0, sizeof(*reply_data));
reply_data->base.dev = dev;
memset(&reply_data->ts_info, 0, sizeof(reply_data->ts_info));
reply_data->ts_info.cmd = ETHTOOL_GET_TS_INFO;
reply_data->ts_info.phc_index = -1;

return ehdr;
}
Expand Down

0 comments on commit d0a4a1b

Please sign in to comment.