Skip to content

Commit b0e525d

Browse files
GONG Ruiqigregkh
authored andcommitted
usb: typec: fix pm usage counter imbalance in ucsi_ccg_sync_control()
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 <stable@kernel.org> Fixes: e56aac6 ("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> Link: https://lore.kernel.org/r/20250107015750.2778646-1-gongruiqi1@huawei.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent cdef30e commit b0e525d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/usb/typec/ucsi/ucsi_ccg.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -646,16 +646,16 @@ static int ucsi_ccg_sync_control(struct ucsi *ucsi, u64 command)
646646
UCSI_CMD_CONNECTOR_MASK;
647647
if (con_index == 0) {
648648
ret = -EINVAL;
649-
goto unlock;
649+
goto err_put;
650650
}
651651
con = &uc->ucsi->connector[con_index - 1];
652652
ucsi_ccg_update_set_new_cam_cmd(uc, con, &command);
653653
}
654654

655655
ret = ucsi_sync_control_common(ucsi, command);
656656

657+
err_put:
657658
pm_runtime_put_sync(uc->dev);
658-
unlock:
659659
mutex_unlock(&uc->lock);
660660

661661
return ret;

0 commit comments

Comments
 (0)