platform/chrome: cros_ec_typec: Init mutex in Thunderbolt registration
Subsystems (4)
Tzung-Bi Shih
maintainerPATCH 1/1 platform/chrome: cros_ec_typec: Init mutex in Thunderbolt registration
cros_typec_register_thunderbolt() missed initializing the adata->lock mutex. This leads to a NULL dereference when the mutex is later acquired (e.g. in cros_typec_altmode_work()).
Initialize the mutex in cros_typec_register_thunderbolt() to fix the issue.
--- drivers/platform/chrome/cros_typec_altmode.c | 1 + 1 file changed, 1 insertion(+)
drivers/platform/chrome/cros_typec_altmode.c +1 -0
@@ -359,6 +359,7 @@ cros_typec_register_thunderbolt(struct cros_typec_port *port, }INIT_WORK (&adata->work, cros_typec_altmode_work); +mutex_init (&adata->lock); adata->alt = alt; adata->port = port; adata->ap_mode_entry = true;
Signature · 1 line
2.54.0.545.g6539524ca2-goog
Quoted 28 lines · Tzung-Bi Shih
cros_typec_register_thunderbolt()missed initializing theadata->lockmutex. This leads to a NULL dereference when the mutex is later acquired (e.g. incros_typec_altmode_work()).Initialize the mutex in
cros_typec_register_thunderbolt()to fix the issue.Fixes 3b00be26b16a ("platform/chrome: cros_ec_typec: Thunderbolt support")Signed-off-by Tzung-Bi Shih <[email protected]>--- drivers/platform/chrome/cros_typec_altmode.c | 1 + 1 file changed, 1 insertion(+)drivers/platform/chrome/cros_typec_altmode.c +1
-1@@ -359,6 +359,7 @@ cros_typec_register_thunderbolt(struct cros_typec_port *port, }INIT_WORK (&adata->work, cros_typec_altmode_work); +mutex_init (&adata->lock); adata->alt = alt; adata->port = port; adata->ap_mode_entry = true; --
Quoted 2 lines
2.54.0.545.g6539524ca2-goog
Thanks for the fix.
Quoted 10 lines · Tzung-Bi Shih
cros_typec_register_thunderbolt()missed initializing theadata->lockmutex. This leads to a NULL dereference when the mutex is later acquired (e.g. incros_typec_altmode_work()).Initialize the mutex in
cros_typec_register_thunderbolt()to fix the issue.Fixes 3b00be26b16a ("platform/chrome: cros_ec_typec: Thunderbolt support")Signed-off-by Tzung-Bi Shih <[email protected]>
Thanks for the fix!
Quoted 19 lines
--- drivers/platform/chrome/cros_typec_altmode.c | 1 + 1 file changed, 1 insertion(+)drivers/platform/chrome/cros_typec_altmode.c +1
-0@@ -359,6 +359,7 @@ cros_typec_register_thunderbolt(struct cros_typec_port *port, }INIT_WORK (&adata->work, cros_typec_altmode_work); +mutex_init (&adata->lock); adata->alt = alt; adata->port = port; adata->ap_mode_entry = true;Signature · 1 line
2.54.0.545.g6539524ca2-goog
Tzung-Bi Shih
maintainerQuoted 8 lines · Tzung-Bi Shih
cros_typec_register_thunderbolt()missed initializing theadata->lockmutex. This leads to a NULL dereference when the mutex is later acquired (e.g. incros_typec_altmode_work()).Initialize the mutex in
cros_typec_register_thunderbolt()to fix the issue.[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux.git for-7.1
[1/1] platform/chrome: cros_ec_typec: Init mutex in Thunderbolt registration
commit: 525cb7ba6661074c1c5cc3772bccc6afab6791ef
Thanks!