lkml.org 
[lkml]   [2024]   [Jan]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 1/3] usb: ucsi: Add missing ppm_lock
On Sun, Jan 21, 2024 at 09:41:21PM +0100, Christian A. Ehrhardt wrote:
> Calling ->sync_write must be done while holding the PPM lock as
> the mailbox logic does not support concurrent commands.
>
> At least since the addition of partner task this means that
> ucsi_acknowledge_connector_change should be called with the
> PPM lock held as it calls ->sync_write.
>
> Thus protect the only call to ucsi_acknowledge_connector_change
> with the PPM. All other calls to ->sync_write already happen
> under the PPM lock.
>
> Fixes: b9aa02ca39a4 ("usb: typec: ucsi: Add polling mechanism for partner tasks like alt mode checking")
> Cc: stable@vger.kernel.org
> Signed-off-by: Christian A. Ehrhardt <lk@c--e.de>
> ---
> drivers/usb/typec/ucsi/ucsi.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c
> index 61b64558f96c..8f9dff993b3d 100644
> --- a/drivers/usb/typec/ucsi/ucsi.c
> +++ b/drivers/usb/typec/ucsi/ucsi.c
> @@ -935,7 +935,9 @@ static void ucsi_handle_connector_change(struct work_struct *work)
>
> clear_bit(EVENT_PENDING, &con->ucsi->flags);
>
> + mutex_lock(&ucsi->ppm_lock);
> ret = ucsi_acknowledge_connector_change(ucsi);
> + mutex_unlock(&ucsi->ppm_lock);
> if (ret)
> dev_err(ucsi->dev, "%s: ACK failed (%d)", __func__, ret);

Is this really actually fixing some issue? The function has already
taken the connector lock, so what exactly could happen without this?

thanks,

--
heikki

\
 
 \ /
  Last update: 2024-05-27 14:31    [W:0.058 / U:0.220 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site