Commit e4e02da2 authored by Dan Carpenter's avatar Dan Carpenter Committed by John W. Linville

rndis_wlan: prevent integer overflow in indication()

If we pick a high value for "offset" then it could lead to an integer
overflow and we would get past the check for:
	if (offset + len > buflen) { ...
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 551d6fe6
...@@ -3043,7 +3043,7 @@ static void rndis_wlan_media_specific_indication(struct usbnet *usbdev, ...@@ -3043,7 +3043,7 @@ static void rndis_wlan_media_specific_indication(struct usbnet *usbdev,
struct rndis_indicate *msg, int buflen) struct rndis_indicate *msg, int buflen)
{ {
struct ndis_80211_status_indication *indication; struct ndis_80211_status_indication *indication;
int len, offset; unsigned int len, offset;
offset = offsetof(struct rndis_indicate, status) + offset = offsetof(struct rndis_indicate, status) +
le32_to_cpu(msg->offset); le32_to_cpu(msg->offset);
...@@ -3055,7 +3055,7 @@ static void rndis_wlan_media_specific_indication(struct usbnet *usbdev, ...@@ -3055,7 +3055,7 @@ static void rndis_wlan_media_specific_indication(struct usbnet *usbdev,
return; return;
} }
if (offset + len > buflen) { if (len > buflen || offset > buflen || offset + len > buflen) {
netdev_info(usbdev->net, "media specific indication, too large to fit to buffer (%i > %i)\n", netdev_info(usbdev->net, "media specific indication, too large to fit to buffer (%i > %i)\n",
offset + len, buflen); offset + len, buflen);
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment