summaryrefslogtreecommitdiffstats
path: root/drivers/staging/rtl8188eu
diff options
context:
space:
mode:
authorIvan Safonov <insafonov@gmail.com>2017-05-02 09:01:41 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-05-15 07:41:59 +0200
commit02b19b4c4920cf7976828216b36f0f2317aa20be (patch)
treeaf3c561d47051a807ab9fd6fbe8d9e985a735f53 /drivers/staging/rtl8188eu
parentd86e16da6a5d0a705eda2bd0c9640c3b503a61b7 (diff)
downloadblackbird-op-linux-02b19b4c4920cf7976828216b36f0f2317aa20be.tar.gz
blackbird-op-linux-02b19b4c4920cf7976828216b36f0f2317aa20be.zip
staging:r8188eu: inline unprotect_frame() in mon_recv_decrypted_recv()
It is useful to remove IV/ICV from rtl88eu_mon_recv_hook(). Also unprotect_frame() will be very short without skb_(pull|trim). Signed-off-by: Ivan Safonov <insafonov@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/rtl8188eu')
-rw-r--r--drivers/staging/rtl8188eu/os_dep/mon.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/staging/rtl8188eu/os_dep/mon.c b/drivers/staging/rtl8188eu/os_dep/mon.c
index 7eac87d641cf..53f853f08428 100644
--- a/drivers/staging/rtl8188eu/os_dep/mon.c
+++ b/drivers/staging/rtl8188eu/os_dep/mon.c
@@ -70,6 +70,8 @@ static void mon_recv_decrypted_recv(struct net_device *dev, const u8 *data,
int data_len, int iv_len, int icv_len)
{
struct sk_buff *skb;
+ struct ieee80211_hdr *hdr;
+ int hdr_len;
skb = netdev_alloc_skb(dev, data_len);
if (!skb)
@@ -80,7 +82,19 @@ static void mon_recv_decrypted_recv(struct net_device *dev, const u8 *data,
* Frame data is not encrypted. Strip off protection so
* userspace doesn't think that it is.
*/
- unprotect_frame(skb, iv_len, icv_len);
+
+ hdr = (struct ieee80211_hdr *)skb->data;
+ hdr_len = ieee80211_hdrlen(hdr->frame_control);
+
+ if (skb->len < hdr_len + iv_len + icv_len) {
+ if (ieee80211_has_protected(hdr->frame_control)) {
+ hdr->frame_control &= ~cpu_to_le16(IEEE80211_FCTL_PROTECTED);
+
+ memmove(skb->data + iv_len, skb->data, hdr_len);
+ skb_pull(skb, iv_len);
+ skb_trim(skb, skb->len - icv_len);
+ }
+ }
skb->ip_summed = CHECKSUM_UNNECESSARY;
skb->protocol = eth_type_trans(skb, dev);
OpenPOWER on IntegriCloud