Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 193726
b: refs/heads/master
c: 80f8c5b
h: refs/heads/master
v: v3
  • Loading branch information
Jussi Kivilinna authored and John W. Linville committed Mar 10, 2010
1 parent 1d7165a commit b1bc995
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: eae44756d60c4e938259358090dba5df675dced0
refs/heads/master: 80f8c5b434f94926c6489d7350d58aecb53ab70f
33 changes: 29 additions & 4 deletions trunk/drivers/net/wireless/rndis_wlan.c
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,7 @@ static int rndis_query_oid(struct usbnet *dev, __le32 oid, void *data, int *len)
struct rndis_query_c *get_c;
} u;
int ret, buflen;
int resplen, respoffs, copylen;

buflen = *len + sizeof(*u.get);
if (buflen < CONTROL_BUFFER_SIZE)
Expand Down Expand Up @@ -733,11 +734,34 @@ static int rndis_query_oid(struct usbnet *dev, __le32 oid, void *data, int *len)
le32_to_cpu(u.get_c->status));

if (ret == 0) {
memcpy(data, u.buf + le32_to_cpu(u.get_c->offset) + 8, *len);
resplen = le32_to_cpu(u.get_c->len);
respoffs = le32_to_cpu(u.get_c->offset) + 8;

ret = le32_to_cpu(u.get_c->len);
if (ret > *len)
*len = ret;
if (respoffs > buflen) {
/* Device returned data offset outside buffer, error. */
netdev_dbg(dev->net, "%s(%s): received invalid "
"data offset: %d > %d\n", __func__,
oid_to_string(oid), respoffs, buflen);

ret = -EINVAL;
goto exit_unlock;
}

if ((resplen + respoffs) > buflen) {
/* Device would have returned more data if buffer would
* have been big enough. Copy just the bits that we got.
*/
copylen = buflen - respoffs;
} else {
copylen = resplen;
}

if (copylen > *len)
copylen = *len;

memcpy(data, u.buf + respoffs, copylen);

*len = resplen;

ret = rndis_error_status(u.get_c->status);
if (ret < 0)
Expand All @@ -746,6 +770,7 @@ static int rndis_query_oid(struct usbnet *dev, __le32 oid, void *data, int *len)
le32_to_cpu(u.get_c->status), ret);
}

exit_unlock:
mutex_unlock(&priv->command_lock);

if (u.buf != priv->command_buffer)
Expand Down

0 comments on commit b1bc995

Please sign in to comment.