Skip to content

Commit 2f0df98

Browse files
author
Desnes Nunes
committed
usb: typec: fix potential array underflow in ucsi_ccg_sync_control()
JIRA: https://issues.redhat.com/browse/RHEL-72346 CVE: CVE-2024-53203 commit e56aac6 Author: Dan Carpenter <dan.carpenter@linaro.org> Date: Mon, 11 Nov 2024 14:08:06 +0300 The "command" variable can be controlled by the user via debugfs. The worry is that if con_index is zero then "&uc->ucsi->connector[con_index - 1]" would be an array underflow. Fixes: 170a672 ("usb: typec: ucsi: add support for separate DP altmode devices") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Link: https://lore.kernel.org/r/c69ef0b3-61b0-4dde-98dd-97b97f81d912@stanley.mountain Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Desnes Nunes <desnesn@redhat.com>
1 parent 29a4467 commit 2f0df98

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/usb/typec/ucsi/ucsi_ccg.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,13 +644,18 @@ static int ucsi_ccg_sync_control(struct ucsi *ucsi, u64 command)
644644
uc->has_multiple_dp) {
645645
con_index = (uc->last_cmd_sent >> 16) &
646646
UCSI_CMD_CONNECTOR_MASK;
647+
if (con_index == 0) {
648+
ret = -EINVAL;
649+
goto unlock;
650+
}
647651
con = &uc->ucsi->connector[con_index - 1];
648652
ucsi_ccg_update_set_new_cam_cmd(uc, con, &command);
649653
}
650654

651655
ret = ucsi_sync_control_common(ucsi, command);
652656

653657
pm_runtime_put_sync(uc->dev);
658+
unlock:
654659
mutex_unlock(&uc->lock);
655660

656661
return ret;

0 commit comments

Comments
 (0)