Skip to content

Commit

Permalink
applicom: Fix an unchecked user ioctl range and an error return
Browse files Browse the repository at this point in the history
Closes bug #11408 by checking the card index range for command 0
Fixes the ioctl to return ENOTTY which is correct for unknown ioctls

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Alan Cox authored and torvalds committed Oct 13, 2008
1 parent 17b8206 commit a7be18d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions drivers/char/applicom.c
Original file line number Diff line number Diff line change
Expand Up @@ -712,8 +712,7 @@ static int ac_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un

IndexCard = adgl->num_card-1;

if(cmd != 0 && cmd != 6 &&
((IndexCard >= MAX_BOARD) || !apbs[IndexCard].RamIO)) {
if(cmd != 6 && ((IndexCard >= MAX_BOARD) || !apbs[IndexCard].RamIO)) {
static int warncount = 10;
if (warncount) {
printk( KERN_WARNING "APPLICOM driver IOCTL, bad board number %d\n",(int)IndexCard+1);
Expand Down Expand Up @@ -832,8 +831,7 @@ static int ac_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
}
break;
default:
printk(KERN_INFO "APPLICOM driver ioctl, unknown function code %d\n",cmd) ;
ret = -EINVAL;
ret = -ENOTTY;
break;
}
Dummy = readb(apbs[IndexCard].RamIO + VERS);
Expand Down

0 comments on commit a7be18d

Please sign in to comment.