aboutsummaryrefslogtreecommitdiffstats
path: root/net/irda/af_irda.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-12-26 15:06:56 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2010-12-26 15:06:56 -0500
commitd7c1255a3a21e98bdc64df8ccf005a174d7e6289 (patch)
treeded861029cdacd09b6c2e2de2896a671f71b02cf /net/irda/af_irda.c
parentd3c7e1ab043abd7706db4fbccf327df9e62f7990 (diff)
parentfc75fc8339e7727167443469027540b283daac71 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (42 commits) ipv4: dont create routes on down devices epic100: hamachi: yellowfin: Fix skb allocation size sundance: Fix oopses with corrupted skb_shared_info Revert "ipv4: Allow configuring subnets as local addresses" USB: mcs7830: return negative if auto negotiate fails irda: prevent integer underflow in IRLMP_ENUMDEVICES tcp: fix listening_get_next() atl1c: Do not use legacy PCI power management mac80211: fix mesh forwarding MAINTAINERS: email address change net: Fix range checks in tcf_valid_offset(). net_sched: sch_sfq: fix allot handling hostap: remove netif_stop_queue from init mac80211/rt2x00: add ieee80211_tx_status_ni() typhoon: memory corruption in typhoon_get_drvinfo() net: Add USB PID for new MOSCHIP USB ethernet controller MCS7832 variant net_sched: always clone skbs ipv6: Fragment locally generated tunnel-mode IPSec6 packets as needed. netlink: fix gcc -Wconversion compilation warning asix: add USB ID for Logitec LAN-GTJ U2A ...
Diffstat (limited to 'net/irda/af_irda.c')
-rw-r--r--net/irda/af_irda.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c
index a6de3059746d..c9890e25cd4c 100644
--- a/net/irda/af_irda.c
+++ b/net/irda/af_irda.c
@@ -2280,6 +2280,16 @@ static int irda_getsockopt(struct socket *sock, int level, int optname,
2280 2280
2281 switch (optname) { 2281 switch (optname) {
2282 case IRLMP_ENUMDEVICES: 2282 case IRLMP_ENUMDEVICES:
2283
2284 /* Offset to first device entry */
2285 offset = sizeof(struct irda_device_list) -
2286 sizeof(struct irda_device_info);
2287
2288 if (len < offset) {
2289 err = -EINVAL;
2290 goto out;
2291 }
2292
2283 /* Ask lmp for the current discovery log */ 2293 /* Ask lmp for the current discovery log */
2284 discoveries = irlmp_get_discoveries(&list.len, self->mask.word, 2294 discoveries = irlmp_get_discoveries(&list.len, self->mask.word,
2285 self->nslots); 2295 self->nslots);
@@ -2290,15 +2300,9 @@ static int irda_getsockopt(struct socket *sock, int level, int optname,
2290 } 2300 }
2291 2301
2292 /* Write total list length back to client */ 2302 /* Write total list length back to client */
2293 if (copy_to_user(optval, &list, 2303 if (copy_to_user(optval, &list, offset))
2294 sizeof(struct irda_device_list) -
2295 sizeof(struct irda_device_info)))
2296 err = -EFAULT; 2304 err = -EFAULT;
2297 2305
2298 /* Offset to first device entry */
2299 offset = sizeof(struct irda_device_list) -
2300 sizeof(struct irda_device_info);
2301
2302 /* Copy the list itself - watch for overflow */ 2306 /* Copy the list itself - watch for overflow */
2303 if (list.len > 2048) { 2307 if (list.len > 2048) {
2304 err = -EINVAL; 2308 err = -EINVAL;