Commit e7e9219
usb: typec: tcpm: fix use-after-free case in tcpm_register_source_caps
There could be a potential use-after-free case in
tcpm_register_source_caps(). This could happen when:
* new (say invalid) source caps are advertised
* the existing source caps are unregistered
* tcpm_register_source_caps() returns with an error as
usb_power_delivery_register_capabilities() fails
This causes port->partner_source_caps to hold on to the now freed source
caps.
Reset port->partner_source_caps value to NULL after unregistering
existing source caps.
Fixes: 230ecdf ("usb: typec: tcpm: unregister existing source caps before re-registration")
Cc: [email protected]
Signed-off-by: Amit Sunil Dhamne <[email protected]>
Reviewed-by: Ondrej Jirman <[email protected]>
Reviewed-by: Heikki Krogerus <[email protected]>
Reviewed-by: Dmitry Baryshkov <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>1 parent 8475ffc commit e7e9219
1 file changed
+3
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3014 | 3014 | | |
3015 | 3015 | | |
3016 | 3016 | | |
3017 | | - | |
| 3017 | + | |
3018 | 3018 | | |
| 3019 | + | |
| 3020 | + | |
3019 | 3021 | | |
3020 | 3022 | | |
3021 | 3023 | | |
| |||
0 commit comments