Skip to content
Commit 9a8aadcf authored by Victor Ding's avatar Victor Ding Committed by Tzung-Bi Shih
Browse files

platform/chrome: cros_ec_typec: zero out stale pointers



`cros_typec_get_switch_handles` allocates four pointers when obtaining
type-c switch handles. These pointers are all freed if failing to obtain
any of them; therefore, pointers in `port` become stale. The stale
pointers eventually cause use-after-free or double free in later code
paths. Zeroing out all pointer fields after freeing to eliminate these
stale pointers.

Fixes: f28adb41 ("platform/chrome: cros_ec_typec: Register Type C switches")
Fixes: 1a8912ca ("platform/chrome: cros_ec_typec: Get retimer handle")
Signed-off-by: default avatarVictor Ding <victording@chromium.org>
Acked-by: default avatarPrashant Malani <pmalani@chromium.org>
Signed-off-by: default avatarTzung-Bi Shih <tzungbi@kernel.org>
Link: https://lore.kernel.org/r/20221207093924.v2.1.I1864b6a7ee98824118b93677868d22d3750f439b@changeid
parent 5a2d9662
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment