public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] platform/chrome: cros_ec_typec: Init mutex in Thunderbolt registration
@ 2026-05-05  5:34 Tzung-Bi Shih
  2026-05-05 17:39 ` Abhishek Pandit-Subedi
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Tzung-Bi Shih @ 2026-05-05  5:34 UTC (permalink / raw)
  To: Benson Leung, Abhishek Pandit-Subedi, Jameson Thies,
	Andrei Kuchynski
  Cc: tzungbi, chrome-platform, linux-kernel, stable

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.

Cc: stable@vger.kernel.org
Fixes: 3b00be26b16a ("platform/chrome: cros_ec_typec: Thunderbolt support")
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
---
 drivers/platform/chrome/cros_typec_altmode.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/platform/chrome/cros_typec_altmode.c b/drivers/platform/chrome/cros_typec_altmode.c
index 557340b53af0..66c546bf89b5 100644
--- a/drivers/platform/chrome/cros_typec_altmode.c
+++ b/drivers/platform/chrome/cros_typec_altmode.c
@@ -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;
-- 
2.54.0.545.g6539524ca2-goog


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] platform/chrome: cros_ec_typec: Init mutex in Thunderbolt registration
  2026-05-05  5:34 [PATCH] platform/chrome: cros_ec_typec: Init mutex in Thunderbolt registration Tzung-Bi Shih
@ 2026-05-05 17:39 ` Abhishek Pandit-Subedi
  2026-05-05 17:47 ` Benson Leung
  2026-05-06  2:28 ` Tzung-Bi Shih
  2 siblings, 0 replies; 4+ messages in thread
From: Abhishek Pandit-Subedi @ 2026-05-05 17:39 UTC (permalink / raw)
  To: Tzung-Bi Shih
  Cc: Benson Leung, Jameson Thies, Andrei Kuchynski, chrome-platform,
	linux-kernel, stable

On Mon, May 4, 2026 at 10:34 PM Tzung-Bi Shih <tzungbi@kernel.org> wrote:
>
> 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.
>
> Cc: stable@vger.kernel.org
> Fixes: 3b00be26b16a ("platform/chrome: cros_ec_typec: Thunderbolt support")
> Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
> ---
>  drivers/platform/chrome/cros_typec_altmode.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/platform/chrome/cros_typec_altmode.c b/drivers/platform/chrome/cros_typec_altmode.c
> index 557340b53af0..66c546bf89b5 100644
> --- a/drivers/platform/chrome/cros_typec_altmode.c
> +++ b/drivers/platform/chrome/cros_typec_altmode.c
> @@ -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;
> --
> 2.54.0.545.g6539524ca2-goog
>

Thanks for the fix.

Reviewed-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] platform/chrome: cros_ec_typec: Init mutex in Thunderbolt registration
  2026-05-05  5:34 [PATCH] platform/chrome: cros_ec_typec: Init mutex in Thunderbolt registration Tzung-Bi Shih
  2026-05-05 17:39 ` Abhishek Pandit-Subedi
@ 2026-05-05 17:47 ` Benson Leung
  2026-05-06  2:28 ` Tzung-Bi Shih
  2 siblings, 0 replies; 4+ messages in thread
From: Benson Leung @ 2026-05-05 17:47 UTC (permalink / raw)
  To: Tzung-Bi Shih
  Cc: Benson Leung, Abhishek Pandit-Subedi, Jameson Thies,
	Andrei Kuchynski, chrome-platform, linux-kernel, stable

[-- Attachment #1: Type: text/plain, Size: 1253 bytes --]

On Tue, May 05, 2026 at 05:34:03AM +0000, Tzung-Bi Shih wrote:
> 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.
> 
> Cc: stable@vger.kernel.org
> Fixes: 3b00be26b16a ("platform/chrome: cros_ec_typec: Thunderbolt support")
> Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>

Thanks for the fix!

Reviewed-by: Benson Leung <bleung@chromium.org>


> ---
>  drivers/platform/chrome/cros_typec_altmode.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/platform/chrome/cros_typec_altmode.c b/drivers/platform/chrome/cros_typec_altmode.c
> index 557340b53af0..66c546bf89b5 100644
> --- a/drivers/platform/chrome/cros_typec_altmode.c
> +++ b/drivers/platform/chrome/cros_typec_altmode.c
> @@ -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;
> -- 
> 2.54.0.545.g6539524ca2-goog
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] platform/chrome: cros_ec_typec: Init mutex in Thunderbolt registration
  2026-05-05  5:34 [PATCH] platform/chrome: cros_ec_typec: Init mutex in Thunderbolt registration Tzung-Bi Shih
  2026-05-05 17:39 ` Abhishek Pandit-Subedi
  2026-05-05 17:47 ` Benson Leung
@ 2026-05-06  2:28 ` Tzung-Bi Shih
  2 siblings, 0 replies; 4+ messages in thread
From: Tzung-Bi Shih @ 2026-05-06  2:28 UTC (permalink / raw)
  To: Benson Leung, Abhishek Pandit-Subedi, Jameson Thies,
	Andrei Kuchynski
  Cc: chrome-platform, linux-kernel, stable

On Tue, May 05, 2026 at 05:34:03AM +0000, Tzung-Bi Shih wrote:
> 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.
> 
> [...]

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!

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-05-06  2:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-05  5:34 [PATCH] platform/chrome: cros_ec_typec: Init mutex in Thunderbolt registration Tzung-Bi Shih
2026-05-05 17:39 ` Abhishek Pandit-Subedi
2026-05-05 17:47 ` Benson Leung
2026-05-06  2:28 ` Tzung-Bi Shih

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox