intel-xe.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: "Coelho, Luciano" <luciano.coelho@intel.com>,
	"intel-xe@lists.freedesktop.org" <intel-xe@lists.freedesktop.org>,
	"Borah, Chaitanya Kumar" <chaitanya.kumar.borah@intel.com>,
	"intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>
Cc: "Saarinen, Jani" <jani.saarinen@intel.com>
Subject: Re: [core-for-CI PATCH] usb: typec: ucsi: Fix a potential deadlock in ucsi_send_command_common()
Date: Wed, 07 Aug 2024 15:39:09 +0300	[thread overview]
Message-ID: <87ikwc4idu.fsf@intel.com> (raw)
In-Reply-To: <72632805adb3a2dbec4e0e14a7917b1c038add93.camel@intel.com>

On Wed, 07 Aug 2024, "Coelho, Luciano" <luciano.coelho@intel.com> wrote:
> On Wed, 2024-08-07 at 11:57 +0530, Chaitanya Kumar Borah wrote:
>> From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
>> 
>> The function returns with the ppm_lock held if there's an
>> error or the PPM reports BUSY condition.
>> 
>> This is a core-for-ci patch for [1]
>> 
>> [1] https://lore.kernel.org/linux-usb/20240806112029.2984319-1-heikki.krogerus@linux.intel.com/
>> 
>> Reported-by: Luciano Coelho <luciano.coelho@intel.com>
>> Fixes: 5e9c1662a89b ("usb: typec: ucsi: rework command execution functions")
>> References: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/11849
>> Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
>> ---
>>  drivers/usb/typec/ucsi/ucsi.c | 11 ++++-------
>>  1 file changed, 4 insertions(+), 7 deletions(-)
>> 
>> diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c
>> index dcd3765cc1f5..432a2d6266d7 100644
>> --- a/drivers/usb/typec/ucsi/ucsi.c
>> +++ b/drivers/usb/typec/ucsi/ucsi.c
>> @@ -238,13 +238,10 @@ static int ucsi_send_command_common(struct ucsi *ucsi, u64 cmd,
>>  	mutex_lock(&ucsi->ppm_lock);
>>  
>>  	ret = ucsi_run_command(ucsi, cmd, &cci, data, size, conn_ack);
>> -	if (cci & UCSI_CCI_BUSY) {
>> -		ret = ucsi_run_command(ucsi, UCSI_CANCEL, &cci, NULL, 0, false);
>> -		return ret ? ret : -EBUSY;
>> -	}
>> -
>> -	if (cci & UCSI_CCI_ERROR)
>> -		return ucsi_read_error(ucsi, connector_num);
>> +	if (cci & UCSI_CCI_BUSY)
>> +		ret = ucsi_run_command(ucsi, UCSI_CANCEL, &cci, NULL, 0, false) ?: -EBUSY;
>> +	else if (cci & UCSI_CCI_ERROR)
>> +		ret = ucsi_read_error(ucsi, connector_num);
>>  
>>  	mutex_unlock(&ucsi->ppm_lock);
>>  	return ret;
>
> This is not the exact patch that was sent upstream, where Heikki
> changed my Reported-by to Reported-and-Tested-by (at least).  I think
> the best is to have the patch that was actually sent upstream, because
> it's easier to match later on, when it gets merged in the mainline.
>
> In any case, I think this can be merged as is, so:
>
> Acked-by: Luca Coelho <luciano.coelho@intel.com>

Thanks, pushed to topic/core-for-CI.

BR,
Jani.

>
> --
> Cheers,
> Luca.

-- 
Jani Nikula, Intel

      reply	other threads:[~2024-08-07 12:39 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-07  6:27 [core-for-CI PATCH] usb: typec: ucsi: Fix a potential deadlock in ucsi_send_command_common() Chaitanya Kumar Borah
2024-08-07  6:37 ` ✓ CI.Patch_applied: success for usb: typec: ucsi: Fix a potential deadlock in ucsi_send_command_common() (rev2) Patchwork
2024-08-07  6:37 ` ✗ CI.checkpatch: warning " Patchwork
2024-08-07  6:38 ` ✓ CI.KUnit: success " Patchwork
2024-08-07  6:50 ` ✓ CI.Build: " Patchwork
2024-08-07  6:52 ` ✓ CI.Hooks: " Patchwork
2024-08-07  6:54 ` ✓ CI.checksparse: " Patchwork
2024-08-07  7:14 ` ✓ CI.BAT: " Patchwork
2024-08-07  8:16 ` ✓ CI.FULL: " Patchwork
2024-08-07 11:54 ` [core-for-CI PATCH] usb: typec: ucsi: Fix a potential deadlock in ucsi_send_command_common() Coelho, Luciano
2024-08-07 12:39   ` Jani Nikula [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ikwc4idu.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=chaitanya.kumar.borah@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jani.saarinen@intel.com \
    --cc=luciano.coelho@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).