From: Denis Kirjanov <kda@linux-powerpc.org>
To: linux-wireless@vger.kernel.org
Cc: Denis Kirjanov <kda@linux-powerpc.org>
Subject: [PATCH] mac80211: rx: check for the skb_copy_bits() return value
Date: Tue, 17 Feb 2015 22:12:03 +0300 [thread overview]
Message-ID: <1424200323-5488-1-git-send-email-kda@linux-powerpc.org> (raw)
Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>
---
net/mac80211/rx.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 1101563..4d3ec94 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -685,7 +685,8 @@ static int iwl80211_get_cs_keyid(const struct ieee80211_cipher_scheme *cs,
if (skb->len < hdrlen + cs->hdr_len)
return -EINVAL;
- skb_copy_bits(skb, hdrlen + cs->key_idx_off, &keyid, 1);
+ if (skb_copy_bits(skb, hdrlen + cs->key_idx_off, &keyid, 1))
+ return -EFAULT;
keyid &= cs->key_idx_mask;
keyid >>= cs->key_idx_shift;
@@ -1128,7 +1129,8 @@ ieee80211_rx_h_check(struct ieee80211_rx_data *rx)
if (rx->skb->len < hdrlen + 8)
return RX_DROP_MONITOR;
- skb_copy_bits(rx->skb, hdrlen + 6, ðertype, 2);
+ if (skb_copy_bits(rx->skb, hdrlen + 6, ðertype, 2))
+ return RX_DROP_MONITOR;
if (ethertype == rx->sdata->control_port_protocol)
return RX_CONTINUE;
}
@@ -1614,7 +1616,8 @@ ieee80211_rx_h_decrypt(struct ieee80211_rx_data *rx)
* no need to call ieee80211_wep_get_keyidx,
* it verifies a bunch of things we've done already
*/
- skb_copy_bits(rx->skb, hdrlen + 3, &keyid, 1);
+ if (skb_copy_bits(rx->skb, hdrlen + 3, &keyid, 1))
+ return RX_DROP_MONITOR;
keyidx = keyid >> 6;
}
--
2.1.3
next reply other threads:[~2015-02-17 19:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-17 19:12 Denis Kirjanov [this message]
2015-02-23 11:50 ` [PATCH] mac80211: rx: check for the skb_copy_bits() return value Johannes Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1424200323-5488-1-git-send-email-kda@linux-powerpc.org \
--to=kda@linux-powerpc.org \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.