[Linux1394-cvslog] rev 786 - trunk
Brought to you by:
aeb,
bencollins
From: SVN U. <ben...@li...> - 2003-02-14 01:15:36
|
Author: bencollins Date: 2003-02-13 20:14:59 -0500 (Thu, 13 Feb 2003) New Revision: 786 Modified: trunk/dv1394.c trunk/video1394.c Log: Add sanity check to make sure we only get compat ioctl's that are our own. Modified: trunk/video1394.c ============================================================================== --- trunk/video1394.c (original) +++ trunk/video1394.c 2003-02-13 20:15:00.000000000 -0500 @@ -1365,6 +1365,9 @@ mm_segment_t old_fs; int ret; + if (file->f_op->ioctl != video1394_ioctl) + return -EFAULT; + if (copy_from_user(&wait32, (void *)arg, sizeof(wait32))) return -EFAULT; @@ -1376,9 +1379,13 @@ old_fs = get_fs(); set_fs(KERNEL_DS); if (cmd == VIDEO1394_IOC32_LISTEN_WAIT_BUFFER) - ret = sys_ioctl(fd, VIDEO1394_IOC_LISTEN_WAIT_BUFFER, (unsigned long) &wait); + ret = video1394_ioctl(file->f_dentry->d_inode, file, + VIDEO1394_IOC_LISTEN_WAIT_BUFFER, + (unsigned long) &wait); else - ret = sys_ioctl(fd, VIDEO1394_IOC_LISTEN_POLL_BUFFER, (unsigned long) &wait); + ret = video1394_ioctl(file->f_dentry->d_inode, file, + VIDEO1394_IOC_LISTEN_POLL_BUFFER, + (unsigned long) &wait); set_fs(old_fs); if (!ret) { @@ -1402,6 +1409,9 @@ mm_segment_t old_fs; int ret; + if (file->f_op->ioctl != video1394_ioctl) + return -EFAULT; + if (copy_from_user(&wait32, (void *)arg, sizeof(wait32))) return -EFAULT; @@ -1413,9 +1423,13 @@ old_fs = get_fs(); set_fs(KERNEL_DS); if (cmd == VIDEO1394_IOC32_LISTEN_QUEUE_BUFFER) - ret = sys_ioctl(fd, VIDEO1394_IOC_LISTEN_QUEUE_BUFFER, (unsigned long) &wait); + ret = video1394_ioctl(file->f_dentry->d_inode, file, + VIDEO1394_IOC_LISTEN_QUEUE_BUFFER, + (unsigned long) &wait); else - ret = sys_ioctl(fd, VIDEO1394_IOC_TALK_WAIT_BUFFER, (unsigned long) &wait); + ret = video1394_ioctl(file->f_dentry->d_inode, file, + VIDEO1394_IOC_TALK_WAIT_BUFFER, + (unsigned long) &wait); set_fs(old_fs); return ret; @@ -1424,7 +1438,13 @@ static int video1394_queue_buf32(unsigned int fd, unsigned int cmd, unsigned long arg, struct file *file) { + if (file->f_op->ioctl != video1394_ioctl) + return -EFAULT; + return -EFAULT; + + return video1394_ioctl(file->f_dentry->d_inode, file, + VIDEO1394_IOC_TALK_QUEUE_BUFFER, arg); } #endif /* CONFIG_COMPAT */ Modified: trunk/dv1394.c ============================================================================== --- trunk/dv1394.c (original) +++ trunk/dv1394.c 2003-02-13 20:15:00.000000000 -0500 @@ -2940,6 +2940,9 @@ mm_segment_t old_fs; int ret; + if (file->f_op->ioctl != dv1394_ioctl) + return -EFAULT; + if (copy_from_user(&dv32, (void *)arg, sizeof(dv32))) return -EFAULT; @@ -2953,7 +2956,8 @@ old_fs = get_fs(); set_fs(KERNEL_DS); - ret = sys_ioctl(fd, DV1394_IOC_INIT, (unsigned long) &dv); + ret = dv1394_ioctl(file->f_dentry->d_inode, file, + DV1394_IOC_INIT, (unsigned long)&dv); set_fs(old_fs); return ret; @@ -2967,9 +2971,13 @@ mm_segment_t old_fs; int ret; + if (file->f_op->ioctl != dv1394_ioctl) + return -EFAULT; + old_fs = get_fs(); set_fs(KERNEL_DS); - ret = sys_ioctl(fd, DV1394_IOC_GET_STATUS, (unsigned long) &dv); + ret = dv1394_ioctl(file->f_dentry->d_inode, file, + DV1394_IOC_GET_STATUS, (unsigned long)&dv); set_fs(old_fs); if (!ret) { |