diff options
-rw-r--r-- | fs/compat_ioctl.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index f51696358a21..f0b7256b2f87 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c | |||
@@ -916,6 +916,40 @@ static int sg_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg) | |||
916 | return err; | 916 | return err; |
917 | } | 917 | } |
918 | 918 | ||
919 | struct compat_sg_req_info { /* used by SG_GET_REQUEST_TABLE ioctl() */ | ||
920 | char req_state; | ||
921 | char orphan; | ||
922 | char sg_io_owned; | ||
923 | char problem; | ||
924 | int pack_id; | ||
925 | compat_uptr_t usr_ptr; | ||
926 | unsigned int duration; | ||
927 | int unused; | ||
928 | }; | ||
929 | |||
930 | static int sg_grt_trans(unsigned int fd, unsigned int cmd, unsigned long arg) | ||
931 | { | ||
932 | int err, i; | ||
933 | sg_req_info_t *r; | ||
934 | struct compat_sg_req_info *o = (struct compat_sg_req_info *)arg; | ||
935 | r = compat_alloc_user_space(sizeof(sg_req_info_t)*SG_MAX_QUEUE); | ||
936 | err = sys_ioctl(fd,cmd,(unsigned long)r); | ||
937 | if (err < 0) | ||
938 | return err; | ||
939 | for (i = 0; i < SG_MAX_QUEUE; i++) { | ||
940 | void __user *ptr; | ||
941 | int d; | ||
942 | |||
943 | if (copy_in_user(o + i, r + i, offsetof(sg_req_info_t, usr_ptr)) || | ||
944 | get_user(ptr, &r[i].usr_ptr) || | ||
945 | get_user(d, &r[i].duration) || | ||
946 | put_user((u32)(unsigned long)(ptr), &o[i].usr_ptr) || | ||
947 | put_user(d, &o[i].duration)) | ||
948 | return -EFAULT; | ||
949 | } | ||
950 | return err; | ||
951 | } | ||
952 | |||
919 | struct sock_fprog32 { | 953 | struct sock_fprog32 { |
920 | unsigned short len; | 954 | unsigned short len; |
921 | compat_caddr_t filter; | 955 | compat_caddr_t filter; |
@@ -2794,6 +2828,7 @@ HANDLE_IOCTL(FDPOLLDRVSTAT32, fd_ioctl_trans) | |||
2794 | HANDLE_IOCTL(FDGETFDCSTAT32, fd_ioctl_trans) | 2828 | HANDLE_IOCTL(FDGETFDCSTAT32, fd_ioctl_trans) |
2795 | HANDLE_IOCTL(FDWERRORGET32, fd_ioctl_trans) | 2829 | HANDLE_IOCTL(FDWERRORGET32, fd_ioctl_trans) |
2796 | HANDLE_IOCTL(SG_IO,sg_ioctl_trans) | 2830 | HANDLE_IOCTL(SG_IO,sg_ioctl_trans) |
2831 | HANDLE_IOCTL(SG_GET_REQUEST_TABLE, sg_grt_trans) | ||
2797 | HANDLE_IOCTL(PPPIOCGIDLE32, ppp_ioctl_trans) | 2832 | HANDLE_IOCTL(PPPIOCGIDLE32, ppp_ioctl_trans) |
2798 | HANDLE_IOCTL(PPPIOCSCOMPRESS32, ppp_ioctl_trans) | 2833 | HANDLE_IOCTL(PPPIOCSCOMPRESS32, ppp_ioctl_trans) |
2799 | HANDLE_IOCTL(PPPIOCSPASS32, ppp_sock_fprog_ioctl_trans) | 2834 | HANDLE_IOCTL(PPPIOCSPASS32, ppp_sock_fprog_ioctl_trans) |