staging: wlan-ng: fix use-after-free Read in hfa384x_usbin_callback
authorQiujun Huang <hqjagain@gmail.com>
Thu, 26 Mar 2020 13:18:50 +0000 (21:18 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 26 Mar 2020 14:47:26 +0000 (15:47 +0100)
We can't handle the case length > WLAN_DATA_MAXLEN.
Because the size of rxfrm->data is WLAN_DATA_MAXLEN(2312), and we can't
read more than that.

Thanks-to: Hillf Danton <hdanton@sina.com>
Reported-and-tested-by: syzbot+7d42d68643a35f71ac8a@syzkaller.appspotmail.com
Signed-off-by: Qiujun Huang <hqjagain@gmail.com>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20200326131850.17711-1-hqjagain@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/wlan-ng/hfa384x_usb.c

index e38acb58cd5e4dde3dd64efb7a694e494ff51910..fa1bf8b069fda5898b485dde6210ef7ebbea0b2c 100644 (file)
@@ -3376,6 +3376,8 @@ static void hfa384x_int_rxmonitor(struct wlandevice *wlandev,
             WLAN_HDR_A4_LEN + WLAN_DATA_MAXLEN + WLAN_CRC_LEN)) {
                pr_debug("overlen frm: len=%zd\n",
                         skblen - sizeof(struct p80211_caphdr));
+
+               return;
        }
 
        skb = dev_alloc_skb(skblen);