aboutsummaryrefslogtreecommitdiffstats
path: root/fs/compat_ioctl.c
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /fs/compat_ioctl.c
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'fs/compat_ioctl.c')
-rw-r--r--fs/compat_ioctl.c97
1 files changed, 2 insertions, 95 deletions
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index 03e59aa318eb..61abb638b4bf 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -19,7 +19,6 @@
19#include <linux/compiler.h> 19#include <linux/compiler.h>
20#include <linux/sched.h> 20#include <linux/sched.h>
21#include <linux/smp.h> 21#include <linux/smp.h>
22#include <linux/smp_lock.h>
23#include <linux/ioctl.h> 22#include <linux/ioctl.h>
24#include <linux/if.h> 23#include <linux/if.h>
25#include <linux/if_bridge.h> 24#include <linux/if_bridge.h>
@@ -43,10 +42,9 @@
43#include <linux/tty.h> 42#include <linux/tty.h>
44#include <linux/vt_kern.h> 43#include <linux/vt_kern.h>
45#include <linux/fb.h> 44#include <linux/fb.h>
46#include <linux/videodev.h> 45#include <linux/videodev2.h>
47#include <linux/netdevice.h> 46#include <linux/netdevice.h>
48#include <linux/raw.h> 47#include <linux/raw.h>
49#include <linux/smb_fs.h>
50#include <linux/blkdev.h> 48#include <linux/blkdev.h>
51#include <linux/elevator.h> 49#include <linux/elevator.h>
52#include <linux/rtc.h> 50#include <linux/rtc.h>
@@ -558,25 +556,6 @@ static int mt_ioctl_trans(unsigned int fd, unsigned int cmd, void __user *argp)
558 556
559#endif /* CONFIG_BLOCK */ 557#endif /* CONFIG_BLOCK */
560 558
561static int do_smb_getmountuid(unsigned int fd, unsigned int cmd,
562 compat_uid_t __user *argp)
563{
564 mm_segment_t old_fs = get_fs();
565 __kernel_uid_t kuid;
566 int err;
567
568 cmd = SMB_IOC_GETMOUNTUID;
569
570 set_fs(KERNEL_DS);
571 err = sys_ioctl(fd, cmd, (unsigned long)&kuid);
572 set_fs(old_fs);
573
574 if (err >= 0)
575 err = put_user(kuid, argp);
576
577 return err;
578}
579
580/* Bluetooth ioctls */ 559/* Bluetooth ioctls */
581#define HCIUARTSETPROTO _IOW('U', 200, int) 560#define HCIUARTSETPROTO _IOW('U', 200, int)
582#define HCIUARTGETPROTO _IOR('U', 201, int) 561#define HCIUARTGETPROTO _IOR('U', 201, int)
@@ -599,69 +578,6 @@ static int do_smb_getmountuid(unsigned int fd, unsigned int cmd,
599#define HIDPGETCONNLIST _IOR('H', 210, int) 578#define HIDPGETCONNLIST _IOR('H', 210, int)
600#define HIDPGETCONNINFO _IOR('H', 211, int) 579#define HIDPGETCONNINFO _IOR('H', 211, int)
601 580
602#ifdef CONFIG_BLOCK
603struct raw32_config_request
604{
605 compat_int_t raw_minor;
606 __u64 block_major;
607 __u64 block_minor;
608} __attribute__((packed));
609
610static int get_raw32_request(struct raw_config_request *req, struct raw32_config_request __user *user_req)
611{
612 int ret;
613
614 if (!access_ok(VERIFY_READ, user_req, sizeof(struct raw32_config_request)))
615 return -EFAULT;
616
617 ret = __get_user(req->raw_minor, &user_req->raw_minor);
618 ret |= __get_user(req->block_major, &user_req->block_major);
619 ret |= __get_user(req->block_minor, &user_req->block_minor);
620
621 return ret ? -EFAULT : 0;
622}
623
624static int set_raw32_request(struct raw_config_request *req, struct raw32_config_request __user *user_req)
625{
626 int ret;
627
628 if (!access_ok(VERIFY_WRITE, user_req, sizeof(struct raw32_config_request)))
629 return -EFAULT;
630
631 ret = __put_user(req->raw_minor, &user_req->raw_minor);
632 ret |= __put_user(req->block_major, &user_req->block_major);
633 ret |= __put_user(req->block_minor, &user_req->block_minor);
634
635 return ret ? -EFAULT : 0;
636}
637
638static int raw_ioctl(unsigned fd, unsigned cmd,
639 struct raw32_config_request __user *user_req)
640{
641 int ret;
642
643 switch (cmd) {
644 case RAW_SETBIND:
645 default: { /* RAW_GETBIND */
646 struct raw_config_request req;
647 mm_segment_t oldfs = get_fs();
648
649 if ((ret = get_raw32_request(&req, user_req)))
650 return ret;
651
652 set_fs(KERNEL_DS);
653 ret = sys_ioctl(fd,cmd,(unsigned long)&req);
654 set_fs(oldfs);
655
656 if ((!ret) && (cmd == RAW_GETBIND)) {
657 ret = set_raw32_request(&req, user_req);
658 }
659 break;
660 }
661 }
662 return ret;
663}
664#endif /* CONFIG_BLOCK */
665 581
666struct serial_struct32 { 582struct serial_struct32 {
667 compat_int_t type; 583 compat_int_t type;
@@ -920,6 +836,7 @@ COMPATIBLE_IOCTL(TCSETSW)
920COMPATIBLE_IOCTL(TCSETSF) 836COMPATIBLE_IOCTL(TCSETSF)
921COMPATIBLE_IOCTL(TIOCLINUX) 837COMPATIBLE_IOCTL(TIOCLINUX)
922COMPATIBLE_IOCTL(TIOCSBRK) 838COMPATIBLE_IOCTL(TIOCSBRK)
839COMPATIBLE_IOCTL(TIOCGDEV)
923COMPATIBLE_IOCTL(TIOCCBRK) 840COMPATIBLE_IOCTL(TIOCCBRK)
924COMPATIBLE_IOCTL(TIOCGSID) 841COMPATIBLE_IOCTL(TIOCGSID)
925COMPATIBLE_IOCTL(TIOCGICOUNT) 842COMPATIBLE_IOCTL(TIOCGICOUNT)
@@ -1265,8 +1182,6 @@ COMPATIBLE_IOCTL(OSS_GETVERSION)
1265/* Raw devices */ 1182/* Raw devices */
1266COMPATIBLE_IOCTL(RAW_SETBIND) 1183COMPATIBLE_IOCTL(RAW_SETBIND)
1267COMPATIBLE_IOCTL(RAW_GETBIND) 1184COMPATIBLE_IOCTL(RAW_GETBIND)
1268/* SMB ioctls which do not need any translations */
1269COMPATIBLE_IOCTL(SMB_IOC_NEWCONN)
1270/* Watchdog */ 1185/* Watchdog */
1271COMPATIBLE_IOCTL(WDIOC_GETSUPPORT) 1186COMPATIBLE_IOCTL(WDIOC_GETSUPPORT)
1272COMPATIBLE_IOCTL(WDIOC_GETSTATUS) 1187COMPATIBLE_IOCTL(WDIOC_GETSTATUS)
@@ -1523,15 +1438,7 @@ static long do_ioctl_trans(int fd, unsigned int cmd,
1523 case MTIOCGET32: 1438 case MTIOCGET32:
1524 case MTIOCPOS32: 1439 case MTIOCPOS32:
1525 return mt_ioctl_trans(fd, cmd, argp); 1440 return mt_ioctl_trans(fd, cmd, argp);
1526 /* Raw devices */
1527 case RAW_SETBIND:
1528 case RAW_GETBIND:
1529 return raw_ioctl(fd, cmd, argp);
1530#endif 1441#endif
1531 /* One SMB ioctl needs translations. */
1532#define SMB_IOC_GETMOUNTUID_32 _IOR('u', 1, compat_uid_t)
1533 case SMB_IOC_GETMOUNTUID_32:
1534 return do_smb_getmountuid(fd, cmd, argp);
1535 /* Serial */ 1442 /* Serial */
1536 case TIOCGSERIAL: 1443 case TIOCGSERIAL:
1537 case TIOCSSERIAL: 1444 case TIOCSSERIAL: