Re: [PATCH v3 0/2] cxl: Fix uninitialized access coordinates
Richard Cheng <[email protected]>
| Newsgroups | org.kernel.vger.linux-cxl |
|---|---|
| Message-ID | <anxBWk7E1FOA6P2c@MWDK4CY14F> |
On Wed, Aug 12, 2026 at 04:30:33PM +0800, Guixin Liu wrote: > Two related fixes for stack access_coordinate arrays that are read before > anything writes them, both reachable on real topologies and both ending up > in userspace through the access coordinate sysfs attributes. > > Patch 1 is the v2 cdat fix [1] with one more site covered: the coords array > in cxl_switch_gather_bandwidth() has the same defect as the three arrays in > cxl_endpoint_gather_bandwidth(). > > Patch 2 is new. cxl_endpoint_get_perf_coordinates() returns 0 for an RCD > without writing the caller's array at all, so cxl_port_perf_data_calculate() > combines stack residue with the values parsed from the RCD's CDAT. > > Both were pointed out by the Sashiko review bot on the v2 posting of patch 1. > The third finding in that review - cxl_coordinates_combine() aliasing its > output onto an input and leaving a member alone when an input bandwidth is > zero - is the intended "not reported" behaviour and is not addressed here. > Hi Guixin, Thanks for this, both changes LGTM. Reviewed-by: Richard Cheng <[email protected]> Best regards, Richard Cheng. > [1] https://lore.kernel.org/linux-cxl/[email protected]/ > > v2->v3: > - also zero initialize coords in cxl_switch_gather_bandwidth(), same defect > in the sibling gather path (Sashiko bot) > - new patch 2: clear the output coordinates on the RCD path of > cxl_endpoint_get_perf_coordinates(), which currently returns success > without writing them (Sashiko bot) > - drop "endpoint" from the patch 1 subject, it now covers both gather paths > > v1->v2: > - rebase onto cxl/next > - rewrite the commit message to describe the behaviour rather than narrate > the code change (Alison Schofield) > > Guixin Liu (2): > cxl/cdat: Fix uninitialized stack use in bandwidth gathering > cxl/port: Fix uninitialized coordinates reported for RCDs > > drivers/cxl/core/cdat.c | 8 ++++---- > drivers/cxl/core/port.c | 4 +++- > 2 files changed, 7 insertions(+), 5 deletions(-) > > > base-commit: 7098e9cd98a05c0c5de2fae0c2465f9d966fdd07 > -- > 2.43.7 > >