diff options
| author | Hans de Goede <[email protected]> | 2023-03-08 15:42:43 +0000 |
|---|---|---|
| committer | Greg Kroah-Hartman <[email protected]> | 2023-03-09 13:39:20 +0000 |
| commit | 0482c34ec6f8557e06cd0f8e2d0e20e8ede6a22c (patch) | |
| tree | 59e61219ea7da6bc6a52bf3c6a35f40c0dd741d8 /tools/perf/scripts/python/arm-cs-trace-disasm.py | |
| parent | usb: ucsi: Fix NULL pointer deref in ucsi_connector_change() (diff) | |
| download | kernel-0482c34ec6f8557e06cd0f8e2d0e20e8ede6a22c.tar.gz kernel-0482c34ec6f8557e06cd0f8e2d0e20e8ede6a22c.zip | |
usb: ucsi: Fix ucsi->connector race
ucsi_init() which runs from a workqueue sets ucsi->connector and
on an error will clear it again.
ucsi->connector gets dereferenced by ucsi_resume(), this checks for
ucsi->connector being NULL in case ucsi_init() has not finished yet;
or in case ucsi_init() has failed.
ucsi_init() setting ucsi->connector and then clearing it again on
an error creates a race where the check in ucsi_resume() may pass,
only to have ucsi->connector free-ed underneath it when ucsi_init()
hits an error.
Fix this race by making ucsi_init() store the connector array in
a local variable and only assign it to ucsi->connector on success.
Fixes: bdc62f2bae8f ("usb: typec: ucsi: Simplified registration and I/O API")
Cc: [email protected]
Reviewed-by: Heikki Krogerus <[email protected]>
Signed-off-by: Hans de Goede <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python/arm-cs-trace-disasm.py')
0 files changed, 0 insertions, 0 deletions
