]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
ath6kl: add some bounds checking
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 4 Apr 2019 08:56:51 +0000 (11:56 +0300)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Aug 2019 09:18:49 +0000 (11:18 +0200)
commit7275406575bf21d0551695420d5d44fb1008d986
tree6ba2d56746364cb1a77c725877045f5506959a9f
parent50cf1121a7a74b8beb0832f81e493e51bbe111f4
ath6kl: add some bounds checking

BugLink: https://bugs.launchpad.net/bugs/1839036
[ Upstream commit 5d6751eaff672ea77642e74e92e6c0ac7f9709ab ]

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: bdcd81707973 (" Add ath6kl cleaned up driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/net/wireless/ath/ath6kl/wmi.c