ISDN: Fix data access out of array bounds
authorKarsten Keil <kkeil@suse.de>
Mon, 8 Oct 2007 10:52:09 +0000 (12:52 +0200)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Mon, 8 Oct 2007 20:01:21 +0000 (13:01 -0700)
Fix against access random data bytes outside the dev->chanmap array.
Thanks to Oliver Neukum for pointing me to this issue.

Signed-off-by: Karsten Keil <kkeil@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/isdn/i4l/isdn_common.c

index ec5f4046412fa564644619175c59373ab4ca39e3..4910bca52640ed0bf67d9833a9595f23c41f44fa 100644 (file)
@@ -1135,7 +1135,7 @@ isdn_read(struct file *file, char __user *buf, size_t count, loff_t * off)
                        if (count > dev->drv[drvidx]->stavail)
                                count = dev->drv[drvidx]->stavail;
                        len = dev->drv[drvidx]->interface->readstat(buf, count,
-                                               drvidx, isdn_minor2chan(minor));
+                               drvidx, isdn_minor2chan(minor - ISDN_MINOR_CTRL));
                        if (len < 0) {
                                retval = len;
                                goto out;
@@ -1207,7 +1207,8 @@ isdn_write(struct file *file, const char __user *buf, size_t count, loff_t * off
                 */
                if (dev->drv[drvidx]->interface->writecmd)
                        retval = dev->drv[drvidx]->interface->
-                               writecmd(buf, count, drvidx, isdn_minor2chan(minor));
+                               writecmd(buf, count, drvidx,
+                               isdn_minor2chan(minor - ISDN_MINOR_CTRL));
                else
                        retval = count;
                goto out;