Re: [PATCH v3] platform/chrome: cros_ec_typec: Stop altmode work during partner removal
From: Andrei Kuchynski
Date: Mon Nov 23 2026 - 04:33:31 EST
On Tue, Oct 20, 2026 at 10:21 AM Andrei Kuchynski
<akuchynski@xxxxxxxxxxxx> wrote:
>
> On Sun, Oct 18, 2026 at 4:34 AM Myeonghun Pak <mhun512@xxxxxxxxx> wrote:
> >
> > DisplayPort and Thunderbolt port altmodes queue work to deliver VDM
> > responses to partner drivers. Partner altmode unregistration does not
> > drain this work, so it can run while the partner driver is being removed
> > and access released driver data.
> >
> > Look up the corresponding port altmode with typec_altmode_get_partner()
> > and disable its work before unregistering the partner altmode. Keep the
> > work disabled while the partner driver is removed, then clear pending
> > response and DP status state before re-enabling it for a new connection.
> > Use the same cleanup when list-node allocation fails after registering
> > an altmode.
> >
> > This issue was identified as part of our ongoing research while
> > reviewing kernel code.
> >
> > Fixes: dbb3fc0ffa95 ("platform/chrome: cros_ec_typec: Displayport support")
> > Cc: stable@xxxxxxxxxxxxxxx
> > Assisted-by: LLM
> > Co-developed-by: Ijae Kim <ae878000@xxxxxxxxx>
> > Signed-off-by: Ijae Kim <ae878000@xxxxxxxxx>
> > Signed-off-by: Myeonghun Pak <mhun512@xxxxxxxxx>
>
> Tested-by: Andrei Kuchynski <akuchynski@xxxxxxxxxxxx>
> ---
> > +void cros_typec_enable_altmode(const struct typec_altmode *alt, bool enable)
> > +{
> > + struct cros_typec_altmode_data *adata = dev_get_drvdata(&alt->dev);
> > + struct cros_typec_dp_data *dp_data;
> > +
> > + /* An altmode without its optional implementation has no work. */
> > + if (!adata)
> > + return;
> > +
> > + if (!enable) {
> > + disable_work_sync(&adata->work);
> > + return;
> > + }
> > +
> > + mutex_lock(&adata->lock);
>
> That won't be necessary, as there is no activity at the moment.
Hi Myeonghun,
Could you please send V4 without `mutex_lock`?
Thanks,
Andrei