From: Linus Torvalds Date: Thu, 25 Oct 2018 19:48:22 +0000 (-0700) Subject: Merge branch 'work.compat' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs X-Git-Tag: 4.20-rc1-smb3-fixes~117 X-Git-Url: http://git.samba.org/samba.git/?p=sfrench%2Fcifs-2.6.git;a=commitdiff_plain;h=ba7d4f36a2ec7d6f8d9e5c6cabbc57469dd4dc22 Merge branch 'work.compat' of git://git./linux/kernel/git/viro/vfs Pull compat_ioctl fixes from Al Viro: "A bunch of compat_ioctl fixes, mostly in bluetooth. Hopefully, most of fs/compat_ioctl.c will get killed off over the next few cycles; between this, tty series already merged and Arnd's work this cycle ought to take a good chunk out of the damn thing..." * 'work.compat' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: hidp: fix compat_ioctl hidp: constify hidp_connection_add() cmtp: fix compat_ioctl bnep: fix compat_ioctl compat_ioctl: trim the pointless includes --- ba7d4f36a2ec7d6f8d9e5c6cabbc57469dd4dc22 diff --cc fs/compat_ioctl.c index 0c445a03e682,e8430facd7cc..ce2cc2169040 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@@ -544,22 -534,68 +506,6 @@@ static int mt_ioctl_trans(struct file * #define HCIUARTSETFLAGS _IOW('U', 203, int) #define HCIUARTGETFLAGS _IOR('U', 204, int) - #define BNEPCONNADD _IOW('B', 200, int) - #define BNEPCONNDEL _IOW('B', 201, int) - #define BNEPGETCONNLIST _IOR('B', 210, int) - #define BNEPGETCONNINFO _IOR('B', 211, int) - #define BNEPGETSUPPFEAT _IOR('B', 212, int) -struct serial_struct32 { - compat_int_t type; - compat_int_t line; - compat_uint_t port; - compat_int_t irq; - compat_int_t flags; - compat_int_t xmit_fifo_size; - compat_int_t custom_divisor; - compat_int_t baud_base; - unsigned short close_delay; - char io_type; - char reserved_char[1]; - compat_int_t hub6; - unsigned short closing_wait; /* time to wait before closing */ - unsigned short closing_wait2; /* no longer used... */ - compat_uint_t iomem_base; - unsigned short iomem_reg_shift; - unsigned int port_high; - /* compat_ulong_t iomap_base FIXME */ - compat_int_t reserved[1]; -}; -- - #define CMTPCONNADD _IOW('C', 200, int) - #define CMTPCONNDEL _IOW('C', 201, int) - #define CMTPGETCONNLIST _IOR('C', 210, int) - #define CMTPGETCONNINFO _IOR('C', 211, int) -static int serial_struct_ioctl(struct file *file, - unsigned cmd, struct serial_struct32 __user *ss32) -{ - typedef struct serial_struct32 SS32; - int err; - struct serial_struct __user *ss = compat_alloc_user_space(sizeof(*ss)); - __u32 udata; - unsigned int base; - unsigned char *iomem_base; -- - #define HIDPCONNADD _IOW('H', 200, int) - #define HIDPCONNDEL _IOW('H', 201, int) - #define HIDPGETCONNLIST _IOR('H', 210, int) - #define HIDPGETCONNINFO _IOR('H', 211, int) - if (ss == NULL) - return -EFAULT; - if (cmd == TIOCSSERIAL) { - if (copy_in_user(ss, ss32, offsetof(SS32, iomem_base)) || - get_user(udata, &ss32->iomem_base)) - return -EFAULT; - iomem_base = compat_ptr(udata); - if (put_user(iomem_base, &ss->iomem_base) || - convert_in_user(&ss32->iomem_reg_shift, - &ss->iomem_reg_shift) || - convert_in_user(&ss32->port_high, &ss->port_high) || - put_user(0UL, &ss->iomap_base)) - return -EFAULT; - } - err = do_ioctl(file, cmd, (unsigned long)ss); - if (cmd == TIOCGSERIAL && err >= 0) { - if (copy_in_user(ss32, ss, offsetof(SS32, iomem_base)) || - get_user(iomem_base, &ss->iomem_base)) - return -EFAULT; - base = (unsigned long)iomem_base >> 32 ? - 0xffffffff : (unsigned)(unsigned long)iomem_base; - if (put_user(base, &ss32->iomem_base) || - convert_in_user(&ss->iomem_reg_shift, - &ss32->iomem_reg_shift) || - convert_in_user(&ss->port_high, &ss32->port_high)) - return -EFAULT; - } - return err; -} -- #define RTC_IRQP_READ32 _IOR('p', 0x0b, compat_ulong_t) #define RTC_IRQP_SET32 _IOW('p', 0x0c, compat_ulong_t) #define RTC_EPOCH_READ32 _IOR('p', 0x0d, compat_ulong_t)