Patch "platform/chrome: cros_ec_typec: zero out stale pointers" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    platform/chrome: cros_ec_typec: zero out stale pointers

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     platform-chrome-cros_ec_typec-zero-out-stale-pointer.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 3207d8f5bf04eddd4ca238f556869490972dfdbb
Author: Victor Ding <victording@xxxxxxxxxxxx>
Date:   Wed Dec 7 09:39:40 2022 +0000

    platform/chrome: cros_ec_typec: zero out stale pointers
    
    [ Upstream commit 9a8aadcf0b459c1257b9477fd6402e1d5952ae07 ]
    
    `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: f28adb41dab4 ("platform/chrome: cros_ec_typec: Register Type C switches")
    Fixes: 1a8912caba02 ("platform/chrome: cros_ec_typec: Get retimer handle")
    Signed-off-by: Victor Ding <victording@xxxxxxxxxxxx>
    Acked-by: Prashant Malani <pmalani@xxxxxxxxxxxx>
    Signed-off-by: Tzung-Bi Shih <tzungbi@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20221207093924.v2.1.I1864b6a7ee98824118b93677868d22d3750f439b@changeid
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c
index d63be2b3d10e..b94abb8f7706 100644
--- a/drivers/platform/chrome/cros_ec_typec.c
+++ b/drivers/platform/chrome/cros_ec_typec.c
@@ -157,8 +157,10 @@ static int cros_typec_get_switch_handles(struct cros_typec_port *port,
 
 role_sw_err:
 	typec_switch_put(port->ori_sw);
+	port->ori_sw = NULL;
 ori_sw_err:
 	typec_mux_put(port->mux);
+	port->mux = NULL;
 mux_err:
 	return -ENODEV;
 }



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux