Skip to content

net/cnxk: harden telemetry parameter parsing

Stephen Hemminger dpdk-dev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2net/cnxk: fix telemetry SA info parameter parsingdrivers/net/cnxk/cnxk_ethdev_sec_telemetry.c+24 -260 replies
2/2common/cnxk: fix thread-unsafe NIX telemetry parsingdrivers/common/cnxk/cnxk_telemetry_nix.c+30 -502 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] net/cnxk: harden telemetry parameter parsing

The cnxk telemetry handlers parse their command parameters with strtok(), which keeps non-reentrant internal state and races when telemetry callbacks run on per-connection threads. Both handlers also trust the parsed integers more than they should: values are narrowed to the destination width or aliased to a valid index before any range check, so an out-of-range port or queue id can slip through and read past the backing array.

These two patches replace the strtok() walks with strtoul()/endptr parsing, range-check each value before it is used, and drop the strdup()/free() that the old SA-info path needed. The NIX handler additionally copies the full parameter string rather than capping it at PCI_PRI_STR_SIZE + 1, which had been truncating the queue id for longer device addresses.

Stephen Hemminger (2):
net/cnxk: fix telemetry SA info parameter parsing common/cnxk: fix thread-unsafe NIX telemetry parsing

 drivers/common/cnxk/cnxk_telemetry_nix.c     | 80 ++++++++------------
 drivers/net/cnxk/cnxk_ethdev_sec_telemetry.c | 50 ++++++------
 2 files changed, 54 insertions(+), 76 deletions(-)
Signature · 1 line
2.53.0