Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 223650
b: refs/heads/master
c: fdac1e0
h: refs/heads/master
v: v3
  • Loading branch information
Dan Rosenberg authored and David S. Miller committed Dec 23, 2010
1 parent 3b9116e commit d0aae33
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 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: 1bde5ac49398a064c753bb490535cfad89e99a5f
refs/heads/master: fdac1e0697356ac212259f2147aa60c72e334861
18 changes: 11 additions & 7 deletions trunk/net/irda/af_irda.c
Original file line number Diff line number Diff line change
Expand Up @@ -2281,6 +2281,16 @@ static int irda_getsockopt(struct socket *sock, int level, int optname,

switch (optname) {
case IRLMP_ENUMDEVICES:

/* Offset to first device entry */
offset = sizeof(struct irda_device_list) -
sizeof(struct irda_device_info);

if (len < offset) {
err = -EINVAL;
goto out;
}

/* Ask lmp for the current discovery log */
discoveries = irlmp_get_discoveries(&list.len, self->mask.word,
self->nslots);
Expand All @@ -2291,15 +2301,9 @@ static int irda_getsockopt(struct socket *sock, int level, int optname,
}

/* Write total list length back to client */
if (copy_to_user(optval, &list,
sizeof(struct irda_device_list) -
sizeof(struct irda_device_info)))
if (copy_to_user(optval, &list, offset))
err = -EFAULT;

/* Offset to first device entry */
offset = sizeof(struct irda_device_list) -
sizeof(struct irda_device_info);

/* Copy the list itself - watch for overflow */
if (list.len > 2048) {
err = -EINVAL;
Expand Down

0 comments on commit d0aae33

Please sign in to comment.