From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: GONG Ruiqi <gongruiqi1@huawei.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Dan Carpenter <dan.carpenter@linaro.org>,
Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] usb: typec: fix pm usage counter imbalance in ucsi_ccg_sync_control()
Date: Tue, 7 Jan 2025 12:16:32 +0200 [thread overview]
Message-ID: <Z3z_AHHPxCmfxMk1@kuha.fi.intel.com> (raw)
In-Reply-To: <20250107015750.2778646-1-gongruiqi1@huawei.com>
On Tue, Jan 07, 2025 at 09:57:50AM +0800, GONG Ruiqi wrote:
> The error handling for the case `con_index == 0` should involve dropping
> the pm usage counter, as ucsi_ccg_sync_control() gets it at the
> beginning. Fix it.
>
> Cc: stable@vger.kernel.org
> Fixes: e56aac6e5a25 ("usb: typec: fix potential array underflow in ucsi_ccg_sync_control()")
> Signed-off-by: GONG Ruiqi <gongruiqi1@huawei.com>
> Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> ---
>
> v2: complement `Cc: stable` as requested
> v1: https://lore.kernel.org/all/20241230093523.1237231-1-gongruiqi1@huawei.com/
>
> drivers/usb/typec/ucsi/ucsi_ccg.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/typec/ucsi/ucsi_ccg.c b/drivers/usb/typec/ucsi/ucsi_ccg.c
> index fcb8e61136cf..740171f24ef9 100644
> --- a/drivers/usb/typec/ucsi/ucsi_ccg.c
> +++ b/drivers/usb/typec/ucsi/ucsi_ccg.c
> @@ -646,7 +646,7 @@ static int ucsi_ccg_sync_control(struct ucsi *ucsi, u64 command)
> UCSI_CMD_CONNECTOR_MASK;
> if (con_index == 0) {
> ret = -EINVAL;
> - goto unlock;
> + goto err_put;
> }
> con = &uc->ucsi->connector[con_index - 1];
> ucsi_ccg_update_set_new_cam_cmd(uc, con, &command);
> @@ -654,8 +654,8 @@ static int ucsi_ccg_sync_control(struct ucsi *ucsi, u64 command)
>
> ret = ucsi_sync_control_common(ucsi, command);
>
> +err_put:
> pm_runtime_put_sync(uc->dev);
> -unlock:
> mutex_unlock(&uc->lock);
>
> return ret;
> --
> 2.25.1
--
heikki
prev parent reply other threads:[~2025-01-07 10:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-07 1:57 [PATCH v2] usb: typec: fix pm usage counter imbalance in ucsi_ccg_sync_control() GONG Ruiqi
2025-01-07 10:16 ` Heikki Krogerus [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=Z3z_AHHPxCmfxMk1@kuha.fi.intel.com \
--to=heikki.krogerus@linux.intel.com \
--cc=dan.carpenter@linaro.org \
--cc=dmitry.baryshkov@linaro.org \
--cc=gongruiqi1@huawei.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
/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