mirror of
https://github.com/adulau/aha.git
synced 2024-12-27 19:26:25 +00:00
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>
This commit is contained in:
parent
dd5d81f326
commit
dc80df567d
1 changed files with 11 additions and 11 deletions
|
@ -281,12 +281,6 @@ static long mwave_ioctl(struct file *file, unsigned int iocmd,
|
||||||
case IOCTL_MW_REGISTER_IPC: {
|
case IOCTL_MW_REGISTER_IPC: {
|
||||||
unsigned int ipcnum = (unsigned int) ioarg;
|
unsigned int ipcnum = (unsigned int) ioarg;
|
||||||
|
|
||||||
PRINTK_3(TRACE_MWAVE,
|
|
||||||
"mwavedd::mwave_ioctl IOCTL_MW_REGISTER_IPC"
|
|
||||||
" ipcnum %x entry usIntCount %x\n",
|
|
||||||
ipcnum,
|
|
||||||
pDrvData->IPCs[ipcnum].usIntCount);
|
|
||||||
|
|
||||||
if (ipcnum >= ARRAY_SIZE(pDrvData->IPCs)) {
|
if (ipcnum >= ARRAY_SIZE(pDrvData->IPCs)) {
|
||||||
PRINTK_ERROR(KERN_ERR_MWAVE
|
PRINTK_ERROR(KERN_ERR_MWAVE
|
||||||
"mwavedd::mwave_ioctl:"
|
"mwavedd::mwave_ioctl:"
|
||||||
|
@ -295,6 +289,12 @@ static long mwave_ioctl(struct file *file, unsigned int iocmd,
|
||||||
ipcnum);
|
ipcnum);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
PRINTK_3(TRACE_MWAVE,
|
||||||
|
"mwavedd::mwave_ioctl IOCTL_MW_REGISTER_IPC"
|
||||||
|
" ipcnum %x entry usIntCount %x\n",
|
||||||
|
ipcnum,
|
||||||
|
pDrvData->IPCs[ipcnum].usIntCount);
|
||||||
|
|
||||||
lock_kernel();
|
lock_kernel();
|
||||||
pDrvData->IPCs[ipcnum].bIsHere = FALSE;
|
pDrvData->IPCs[ipcnum].bIsHere = FALSE;
|
||||||
pDrvData->IPCs[ipcnum].bIsEnabled = TRUE;
|
pDrvData->IPCs[ipcnum].bIsEnabled = TRUE;
|
||||||
|
@ -310,11 +310,6 @@ static long mwave_ioctl(struct file *file, unsigned int iocmd,
|
||||||
case IOCTL_MW_GET_IPC: {
|
case IOCTL_MW_GET_IPC: {
|
||||||
unsigned int ipcnum = (unsigned int) ioarg;
|
unsigned int ipcnum = (unsigned int) ioarg;
|
||||||
|
|
||||||
PRINTK_3(TRACE_MWAVE,
|
|
||||||
"mwavedd::mwave_ioctl IOCTL_MW_GET_IPC"
|
|
||||||
" ipcnum %x, usIntCount %x\n",
|
|
||||||
ipcnum,
|
|
||||||
pDrvData->IPCs[ipcnum].usIntCount);
|
|
||||||
if (ipcnum >= ARRAY_SIZE(pDrvData->IPCs)) {
|
if (ipcnum >= ARRAY_SIZE(pDrvData->IPCs)) {
|
||||||
PRINTK_ERROR(KERN_ERR_MWAVE
|
PRINTK_ERROR(KERN_ERR_MWAVE
|
||||||
"mwavedd::mwave_ioctl:"
|
"mwavedd::mwave_ioctl:"
|
||||||
|
@ -322,6 +317,11 @@ static long mwave_ioctl(struct file *file, unsigned int iocmd,
|
||||||
" Invalid ipcnum %x\n", ipcnum);
|
" Invalid ipcnum %x\n", ipcnum);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
PRINTK_3(TRACE_MWAVE,
|
||||||
|
"mwavedd::mwave_ioctl IOCTL_MW_GET_IPC"
|
||||||
|
" ipcnum %x, usIntCount %x\n",
|
||||||
|
ipcnum,
|
||||||
|
pDrvData->IPCs[ipcnum].usIntCount);
|
||||||
|
|
||||||
lock_kernel();
|
lock_kernel();
|
||||||
if (pDrvData->IPCs[ipcnum].bIsEnabled == TRUE) {
|
if (pDrvData->IPCs[ipcnum].bIsEnabled == TRUE) {
|
||||||
|
|
Loading…
Reference in a new issue