ath6kl: add some bounds checking
The "ev->traffic_class" and "reply->ac" variables come from the network
and they're used as an offset into the wmi->stream_exist_for_ac[] array.
Those variables are u8 so they can be 0-255 but the stream_exist_for_ac[]
array only has WMM_NUM_AC (4) elements. We need to add a couple bounds
checks to prevent array overflows.
I also modified one existing check from "if (traffic_class > 3) {" to
"if (traffic_class >= WMM_NUM_AC) {" just to make them all consistent.
Fixes: bdcd817079 (" Add ath6kl cleaned up driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
This commit is contained in:
committed by
Kalle Valo
parent
83d9562b64
commit
5d6751eaff
@@ -1176,6 +1176,10 @@ static int ath6kl_wmi_pstream_timeout_event_rx(struct wmi *wmi, u8 *datap,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
ev = (struct wmi_pstream_timeout_event *) datap;
|
ev = (struct wmi_pstream_timeout_event *) datap;
|
||||||
|
if (ev->traffic_class >= WMM_NUM_AC) {
|
||||||
|
ath6kl_err("invalid traffic class: %d\n", ev->traffic_class);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* When the pstream (fat pipe == AC) timesout, it means there were
|
* When the pstream (fat pipe == AC) timesout, it means there were
|
||||||
@@ -1516,6 +1520,10 @@ static int ath6kl_wmi_cac_event_rx(struct wmi *wmi, u8 *datap, int len,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
reply = (struct wmi_cac_event *) datap;
|
reply = (struct wmi_cac_event *) datap;
|
||||||
|
if (reply->ac >= WMM_NUM_AC) {
|
||||||
|
ath6kl_err("invalid AC: %d\n", reply->ac);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
if ((reply->cac_indication == CAC_INDICATION_ADMISSION_RESP) &&
|
if ((reply->cac_indication == CAC_INDICATION_ADMISSION_RESP) &&
|
||||||
(reply->status_code != IEEE80211_TSPEC_STATUS_ADMISS_ACCEPTED)) {
|
(reply->status_code != IEEE80211_TSPEC_STATUS_ADMISS_ACCEPTED)) {
|
||||||
@@ -2632,7 +2640,7 @@ int ath6kl_wmi_delete_pstream_cmd(struct wmi *wmi, u8 if_idx, u8 traffic_class,
|
|||||||
u16 active_tsids = 0;
|
u16 active_tsids = 0;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (traffic_class > 3) {
|
if (traffic_class >= WMM_NUM_AC) {
|
||||||
ath6kl_err("invalid traffic class: %d\n", traffic_class);
|
ath6kl_err("invalid traffic class: %d\n", traffic_class);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user