From: Dan Carpenter Date: Fri, 18 Sep 2020 14:27:32 +0000 (+0300) Subject: ath6kl: wmi: prevent a shift wrapping bug in ath6kl_wmi_delete_pstream_cmd() X-Git-Tag: io_uring-5.10-2020-10-20~32^2~150^2~1^2 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=6a950755cec1a90ddaaff3e4acb5333617441c32;p=linux-2.6-block.git ath6kl: wmi: prevent a shift wrapping bug in ath6kl_wmi_delete_pstream_cmd() The "tsid" is a user controlled u8 which comes from debugfs. Values more than 15 are invalid because "active_tsids" is a 16 bit variable. If the value of "tsid" is more than 31 then that leads to a shift wrapping bug. Fixes: 8fffd9e5ec9e ("ath6kl: Implement support for QOS-enable and QOS-disable from userspace") Signed-off-by: Dan Carpenter Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20200918142732.GA909725@mwanda --- diff --git a/drivers/net/wireless/ath/ath6kl/wmi.c b/drivers/net/wireless/ath/ath6kl/wmi.c index a4339cca661f..dbc47702a268 100644 --- a/drivers/net/wireless/ath/ath6kl/wmi.c +++ b/drivers/net/wireless/ath/ath6kl/wmi.c @@ -2639,6 +2639,11 @@ int ath6kl_wmi_delete_pstream_cmd(struct wmi *wmi, u8 if_idx, u8 traffic_class, return -EINVAL; } + if (tsid >= 16) { + ath6kl_err("invalid tsid: %d\n", tsid); + return -EINVAL; + } + skb = ath6kl_wmi_get_new_buf(sizeof(*cmd)); if (!skb) return -ENOMEM;