Skip to content

Commit 183e4d4

Browse files
GONG Ruiqivijay-suman
authored andcommitted
usb: typec: fix pm usage counter imbalance in ucsi_ccg_sync_control()
commit b0e525d upstream. 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 <[email protected]> Fixes: e56aac6 ("usb: typec: fix potential array underflow in ucsi_ccg_sync_control()") Signed-off-by: GONG Ruiqi <[email protected]> Reviewed-by: Dan Carpenter <[email protected]> Reviewed-by: Heikki Krogerus <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]> [Minor context change fixed.] Signed-off-by: Bin Lan <[email protected]> Signed-off-by: He Zhe <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> (cherry picked from commit 6dacd2514eb9fc4fc12ed05761b4c0b020f89601) Signed-off-by: Vijayendra Suman <[email protected]>
1 parent 70edd31 commit 183e4d4

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
@@ -575,7 +575,7 @@ static int ucsi_ccg_sync_write(struct ucsi *ucsi, unsigned int offset,
575575
UCSI_CMD_CONNECTOR_MASK;
576576
if (con_index == 0) {
577577
ret = -EINVAL;
578-
goto unlock;
578+
goto err_put;
579579
}
580580
con = &uc->ucsi->connector[con_index - 1];
581581
ucsi_ccg_update_set_new_cam_cmd(uc, con, (u64 *)val);
@@ -591,8 +591,8 @@ static int ucsi_ccg_sync_write(struct ucsi *ucsi, unsigned int offset,
591591

592592
err_clear_bit:
593593
clear_bit(DEV_CMD_PENDING, &uc->flags);
594+
err_put:
594595
pm_runtime_put_sync(uc->dev);
595-
unlock:
596596
mutex_unlock(&uc->lock);
597597

598598
return ret;

0 commit comments

Comments
 (0)