public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] usb: typec: ucsi: fix input validation in UCSI core
@ 2026-02-19 16:49 Nathan Rebello
  2026-02-19 16:49 ` [PATCH 1/2] usb: typec: ucsi: validate connector number in ucsi_connector_change() Nathan Rebello
  2026-02-19 16:49 ` [PATCH 2/2] usb: typec: ucsi: clamp returned length in ucsi_run_command() Nathan Rebello
  0 siblings, 2 replies; 10+ messages in thread
From: Nathan Rebello @ 2026-02-19 16:49 UTC (permalink / raw)
  To: linux-usb; +Cc: heikki.krogerus, gregkh, Nathan Rebello

Two input validation fixes for the UCSI core driver:

Patch 1 adds a bounds check on the connector number in
ucsi_connector_change(). The connector number is extracted from the CCI
register (7-bit field, range 1-127) but is used to index the connector
array without validation. A malicious or malfunctioning PPM could cause
an out-of-bounds access.

Patch 2 clamps the return value of ucsi_run_command() to the caller's
buffer size. The current code returns UCSI_CCI_LENGTH() directly from
the CCI register, which may exceed the buffer provided by the caller,
leading to out-of-bounds reads in callers like ucsi_register_altmodes().

Both issues were found via static analysis and confirmed with
libFuzzer and AddressSanitizer.

Nathan Rebello (2):
  usb: typec: ucsi: validate connector number in ucsi_connector_change()
  usb: typec: ucsi: clamp returned length in ucsi_run_command()

 drivers/usb/typec/ucsi/ucsi.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

-- 
2.43.0.windows.1


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

end of thread, other threads:[~2026-03-12  5:44 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-19 16:49 [PATCH 0/2] usb: typec: ucsi: fix input validation in UCSI core Nathan Rebello
2026-02-19 16:49 ` [PATCH 1/2] usb: typec: ucsi: validate connector number in ucsi_connector_change() Nathan Rebello
2026-02-20  6:09   ` Greg KH
2026-02-20  6:34   ` Nathan Rebello
2026-02-20  6:53     ` Greg KH
2026-03-11 13:10   ` Greg KH
2026-03-11 21:49     ` Nathan Rebello
2026-03-12  5:03       ` Greg KH
2026-03-12  5:44         ` Nathan Rebello
2026-02-19 16:49 ` [PATCH 2/2] usb: typec: ucsi: clamp returned length in ucsi_run_command() Nathan Rebello

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox