diff options
author | Hamad Kadmany <qca_hkadmany@qca.qualcomm.com> | 2017-08-08 14:16:40 +0300 |
---|---|---|
committer | Kalle Valo <kvalo@qca.qualcomm.com> | 2017-08-08 21:43:45 +0300 |
commit | 6641525ce40ef45641c8f43bb19cd4e471e4cb75 (patch) | |
tree | 13a486ca9a9d811d54dc4f3acc4ee91b9525339e | |
parent | 3588e1110e49fdad7fc8898420a9c71b34a3ca04 (diff) | |
download | linux-6641525ce40ef45641c8f43bb19cd4e471e4cb75.tar.xz |
wil6210: protect against invalid length of tx management frame
Validate buffer length has the minimum needed size
when sending management frame to protect against
possible buffer overrun.
Signed-off-by: Hamad Kadmany <qca_hkadmany@qca.qualcomm.com>
Signed-off-by: Lior David <qca_liord@qca.qualcomm.com>
Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
-rw-r--r-- | drivers/net/wireless/ath/wil6210/cfg80211.c | 3 | ||||
-rw-r--r-- | drivers/net/wireless/ath/wil6210/debugfs.c | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/wil6210/cfg80211.c b/drivers/net/wireless/ath/wil6210/cfg80211.c index 0b5383a62d42..77af7492420d 100644 --- a/drivers/net/wireless/ath/wil6210/cfg80211.c +++ b/drivers/net/wireless/ath/wil6210/cfg80211.c @@ -884,6 +884,9 @@ int wil_cfg80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, wil_hex_dump_misc("mgmt tx frame ", DUMP_PREFIX_OFFSET, 16, 1, buf, len, true); + if (len < sizeof(struct ieee80211_hdr_3addr)) + return -EINVAL; + cmd = kmalloc(sizeof(*cmd) + len, GFP_KERNEL); if (!cmd) { rc = -ENOMEM; diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c b/drivers/net/wireless/ath/wil6210/debugfs.c index f82506d276d3..a2b5d595aa19 100644 --- a/drivers/net/wireless/ath/wil6210/debugfs.c +++ b/drivers/net/wireless/ath/wil6210/debugfs.c @@ -801,6 +801,9 @@ static ssize_t wil_write_file_txmgmt(struct file *file, const char __user *buf, int rc; void *frame; + if (!len) + return -EINVAL; + frame = memdup_user(buf, len); if (IS_ERR(frame)) return PTR_ERR(frame); |