Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 41eedf39 authored by Dan Carpenter's avatar Dan Carpenter Committed by John W. Linville
Browse files

rndis_wlan: integer overflows in rndis_wlan_do_link_up_work()



If "offset" is negative then we can get past this check:
	if (offset > CONTROL_BUFFER_SIZE)
Or if we pick a very high "req_ie_len" then we can get around the check:
	if (offset + req_ie_len > CONTROL_BUFFER_SIZE)

I made "resp_ie_len" and "req_ie_len" unsigned.  I don't know if it was
intentional that they were signed in the original.

Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Acked-by: default avatarJussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 55335137
Loading
Loading
Loading
Loading
+9 −4
Original line number Original line Diff line number Diff line
@@ -2755,9 +2755,10 @@ static void rndis_wlan_do_link_up_work(struct usbnet *usbdev)
	struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev);
	struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev);
	struct ndis_80211_assoc_info *info = NULL;
	struct ndis_80211_assoc_info *info = NULL;
	u8 bssid[ETH_ALEN];
	u8 bssid[ETH_ALEN];
	int resp_ie_len, req_ie_len;
	unsigned int resp_ie_len, req_ie_len;
	unsigned int offset;
	u8 *req_ie, *resp_ie;
	u8 *req_ie, *resp_ie;
	int ret, offset;
	int ret;
	bool roamed = false;
	bool roamed = false;
	bool match_bss;
	bool match_bss;


@@ -2785,7 +2786,9 @@ static void rndis_wlan_do_link_up_work(struct usbnet *usbdev)
		ret = get_association_info(usbdev, info, CONTROL_BUFFER_SIZE);
		ret = get_association_info(usbdev, info, CONTROL_BUFFER_SIZE);
		if (!ret) {
		if (!ret) {
			req_ie_len = le32_to_cpu(info->req_ie_length);
			req_ie_len = le32_to_cpu(info->req_ie_length);
			if (req_ie_len > 0) {
			if (req_ie_len > CONTROL_BUFFER_SIZE)
				req_ie_len = CONTROL_BUFFER_SIZE;
			if (req_ie_len != 0) {
				offset = le32_to_cpu(info->offset_req_ies);
				offset = le32_to_cpu(info->offset_req_ies);


				if (offset > CONTROL_BUFFER_SIZE)
				if (offset > CONTROL_BUFFER_SIZE)
@@ -2799,7 +2802,9 @@ static void rndis_wlan_do_link_up_work(struct usbnet *usbdev)
			}
			}


			resp_ie_len = le32_to_cpu(info->resp_ie_length);
			resp_ie_len = le32_to_cpu(info->resp_ie_length);
			if (resp_ie_len > 0) {
			if (resp_ie_len > CONTROL_BUFFER_SIZE)
				resp_ie_len = CONTROL_BUFFER_SIZE;
			if (resp_ie_len != 0) {
				offset = le32_to_cpu(info->offset_resp_ies);
				offset = le32_to_cpu(info->offset_resp_ies);


				if (offset > CONTROL_BUFFER_SIZE)
				if (offset > CONTROL_BUFFER_SIZE)