Skip to content

Commit

Permalink
ath6kl: Array index out of bounds check
Browse files Browse the repository at this point in the history
The variable assigned_ep can be assigned value of -1 and is never
checked if it equals -1. So the endpoint array can have -1  as the index
value and can be out of bounds.

The value of assigned_ep is checked for -1 and is ensured that the
endpoint array doesn't go out of bounds.

Signed-off-by: Pandiyarajan Pitchaimuthu <c_ppitch@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
  • Loading branch information
Pandiyarajan Pitchaimuthu authored and Kalle Valo committed Oct 24, 2012
1 parent 698bf86 commit 86aa7c1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/net/wireless/ath/ath6kl/htc_mbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -2492,7 +2492,8 @@ static int ath6kl_htc_mbox_conn_service(struct htc_target *target,
max_msg_sz = le16_to_cpu(resp_msg->max_msg_sz);
}

if (assigned_ep >= ENDPOINT_MAX || !max_msg_sz) {
if (WARN_ON_ONCE(assigned_ep == ENDPOINT_UNUSED ||
assigned_ep >= ENDPOINT_MAX || !max_msg_sz)) {
status = -ENOMEM;
goto fail_tx;
}
Expand Down

0 comments on commit 86aa7c1

Please sign in to comment.