diff options
author | Colin Ian King <colin.king@canonical.com> | 2017-09-21 00:19:57 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-09-22 12:00:58 +0300 |
commit | c51b46dd5b9950436b6b1f8189e93e1ad380cee1 (patch) | |
tree | 1f24446f549071232c8151053f785e148fe8eee9 /drivers/staging/rtl8723bs | |
parent | 974d4d03fc020af4fa4e9e72a86f0fefa37803c5 (diff) | |
download | linux-c51b46dd5b9950436b6b1f8189e93e1ad380cee1.tar.xz |
staging: rtl8723bs: add missing range check on id
The value of the u8 id needs to be upper bounds checked to ensure
the cam_cache array on the adapter dvobj is not indexed outside
of the allowed range of 0..TOTAL_CAM_ENTRY-1. This can currently
occur if id is >= TOTAL_CAM_ENTRY when calling write_cam_from_cache.
Fix this by adding an upper range check.
Detected by CoverityScan, CID#1428464 ("Use of untrusted scalar value")
Fixes: 554c0a3abf21 ("staging: Add rtl8723bs sdio wifi driver")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/rtl8723bs')
-rw-r--r-- | drivers/staging/rtl8723bs/os_dep/rtw_proc.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/staging/rtl8723bs/os_dep/rtw_proc.c b/drivers/staging/rtl8723bs/os_dep/rtw_proc.c index 92277457aba4..ce1dd6f9036f 100644 --- a/drivers/staging/rtl8723bs/os_dep/rtw_proc.c +++ b/drivers/staging/rtl8723bs/os_dep/rtw_proc.c @@ -311,6 +311,8 @@ static ssize_t proc_set_cam(struct file *file, const char __user *buffer, size_t if (num < 2) return count; + if (id >= TOTAL_CAM_ENTRY) + return -EINVAL; if (strcmp("c", cmd) == 0) { _clear_cam_entry(adapter, id); |