diff options
author | Roel Kluin <roel.kluin@gmail.com> | 2009-09-23 18:57:11 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-24 10:21:03 -0400 |
commit | dc80df567dd04738ee8b3922feacf099ae81645e (patch) | |
tree | 709c209b063b72ed2c152ebfe3240210f1b2937e /drivers/char | |
parent | dd5d81f326da8d151939b833993b799c0d0d1d6e (diff) |
mwave: fix read buffer overflow
Check whether index is within bounds before grabbing the element.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/mwave/mwavedd.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/char/mwave/mwavedd.c b/drivers/char/mwave/mwavedd.c index 94ad2c3bfc4a..a4ec50c95072 100644 --- a/drivers/char/mwave/mwavedd.c +++ b/drivers/char/mwave/mwavedd.c | |||
@@ -281,12 +281,6 @@ static long mwave_ioctl(struct file *file, unsigned int iocmd, | |||
281 | case IOCTL_MW_REGISTER_IPC: { | 281 | case IOCTL_MW_REGISTER_IPC: { |
282 | unsigned int ipcnum = (unsigned int) ioarg; | 282 | unsigned int ipcnum = (unsigned int) ioarg; |
283 | 283 | ||
284 | PRINTK_3(TRACE_MWAVE, | ||
285 | "mwavedd::mwave_ioctl IOCTL_MW_REGISTER_IPC" | ||
286 | " ipcnum %x entry usIntCount %x\n", | ||
287 | ipcnum, | ||
288 | pDrvData->IPCs[ipcnum].usIntCount); | ||
289 | |||
290 | if (ipcnum >= ARRAY_SIZE(pDrvData->IPCs)) { | 284 | if (ipcnum >= ARRAY_SIZE(pDrvData->IPCs)) { |
291 | PRINTK_ERROR(KERN_ERR_MWAVE | 285 | PRINTK_ERROR(KERN_ERR_MWAVE |
292 | "mwavedd::mwave_ioctl:" | 286 | "mwavedd::mwave_ioctl:" |
@@ -295,6 +289,12 @@ static long mwave_ioctl(struct file *file, unsigned int iocmd, | |||
295 | ipcnum); | 289 | ipcnum); |
296 | return -EINVAL; | 290 | return -EINVAL; |
297 | } | 291 | } |
292 | PRINTK_3(TRACE_MWAVE, | ||
293 | "mwavedd::mwave_ioctl IOCTL_MW_REGISTER_IPC" | ||
294 | " ipcnum %x entry usIntCount %x\n", | ||
295 | ipcnum, | ||
296 | pDrvData->IPCs[ipcnum].usIntCount); | ||
297 | |||
298 | lock_kernel(); | 298 | lock_kernel(); |
299 | pDrvData->IPCs[ipcnum].bIsHere = FALSE; | 299 | pDrvData->IPCs[ipcnum].bIsHere = FALSE; |
300 | pDrvData->IPCs[ipcnum].bIsEnabled = TRUE; | 300 | pDrvData->IPCs[ipcnum].bIsEnabled = TRUE; |
@@ -310,11 +310,6 @@ static long mwave_ioctl(struct file *file, unsigned int iocmd, | |||
310 | case IOCTL_MW_GET_IPC: { | 310 | case IOCTL_MW_GET_IPC: { |
311 | unsigned int ipcnum = (unsigned int) ioarg; | 311 | unsigned int ipcnum = (unsigned int) ioarg; |
312 | 312 | ||
313 | PRINTK_3(TRACE_MWAVE, | ||
314 | "mwavedd::mwave_ioctl IOCTL_MW_GET_IPC" | ||
315 | " ipcnum %x, usIntCount %x\n", | ||
316 | ipcnum, | ||
317 | pDrvData->IPCs[ipcnum].usIntCount); | ||
318 | if (ipcnum >= ARRAY_SIZE(pDrvData->IPCs)) { | 313 | if (ipcnum >= ARRAY_SIZE(pDrvData->IPCs)) { |
319 | PRINTK_ERROR(KERN_ERR_MWAVE | 314 | PRINTK_ERROR(KERN_ERR_MWAVE |
320 | "mwavedd::mwave_ioctl:" | 315 | "mwavedd::mwave_ioctl:" |
@@ -322,6 +317,11 @@ static long mwave_ioctl(struct file *file, unsigned int iocmd, | |||
322 | " Invalid ipcnum %x\n", ipcnum); | 317 | " Invalid ipcnum %x\n", ipcnum); |
323 | return -EINVAL; | 318 | return -EINVAL; |
324 | } | 319 | } |
320 | PRINTK_3(TRACE_MWAVE, | ||
321 | "mwavedd::mwave_ioctl IOCTL_MW_GET_IPC" | ||
322 | " ipcnum %x, usIntCount %x\n", | ||
323 | ipcnum, | ||
324 | pDrvData->IPCs[ipcnum].usIntCount); | ||
325 | 325 | ||
326 | lock_kernel(); | 326 | lock_kernel(); |
327 | if (pDrvData->IPCs[ipcnum].bIsEnabled == TRUE) { | 327 | if (pDrvData->IPCs[ipcnum].bIsEnabled == TRUE) { |