All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/3] cxl/features: Bounds-check the fwctl feature commands
@ 2026-06-26 10:40 Richard Cheng
  2026-06-26 10:41 ` [PATCH v3 1/3] cxl/features: Reject Get Feature count larger than the output buffer Richard Cheng
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Richard Cheng @ 2026-06-26 10:40 UTC (permalink / raw)
  To: dave, jic23, dave.jiang, alison.schofield, vishal.l.verma, djbw,
	danwilliams
  Cc: iweiny, ming.li, kobak, kaihengf, kees, newtonl, kristinc, mochs,
	linux-cxl, linux-kernel, Richard Cheng

The CXL fwctl feature handlers take buffer sizes from userspace, which is
out_len, and from the device without fully checking them. This series
adds the missing bounds checks.

Patch 1: reject a Get Feature whose count is larger than the output
         buffer.
Patch 2: reject a Set Feature whose output buffer is too small for the
         reply header. A zero out_len makes kvzalloc() return
         ZERO_SIZE_PTR, and the header write then corrupts memory.
Patch 3: clamp the Get Feature read loop to the room left in the output
         buffer, so a device that returns more than requested cannot
         write past it.

A related gap is fixed separately by Zhenhao Wan's patch [1].

Changes since v2:
    - Expand the single Get Feature fix into a series that also covers
      the Set Feature output buffer and the Get Feature read loop.

[1]:
https://lore.kernel.org/all/20260620-cxl-fwctl-oob-v1-1-5758e34d784a@gmail.com/

Richard Cheng (3):
  cxl/features: Reject Get Feature count larger than the output buffer
  cxl/features: Reject Set Features output buffer smaller than the
    header
  cxl/features: Clamp Get Feature output size to the remaining buffer

 drivers/cxl/core/features.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)


base-commit: ef0c9f75a19532d7675384708fc8621e10850104
-- 
2.43.0


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

end of thread, other threads:[~2026-06-30  2:57 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-26 10:40 [PATCH v3 0/3] cxl/features: Bounds-check the fwctl feature commands Richard Cheng
2026-06-26 10:41 ` [PATCH v3 1/3] cxl/features: Reject Get Feature count larger than the output buffer Richard Cheng
2026-06-26 10:54   ` sashiko-bot
2026-06-30  2:50     ` Richard Cheng
2026-06-26 10:41 ` [PATCH v3 2/3] cxl/features: Reject Set Features output buffer smaller than the header Richard Cheng
2026-06-26 10:56   ` sashiko-bot
2026-06-30  2:51     ` Richard Cheng
2026-06-26 10:41 ` [PATCH v3 3/3] cxl/features: Clamp Get Feature output size to the remaining buffer Richard Cheng
2026-06-26 10:52   ` sashiko-bot
2026-06-30  2:57     ` Richard Cheng

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.