diff options
author | Jann Horn <jann@thejh.net> | 2016-01-05 12:27:29 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2016-01-08 21:16:11 -0500 |
commit | b43417216e9ce55e1f1ab7c834c7ab43db0b53e1 (patch) | |
tree | 3b4cee87df4c5e44788f8599d8e3df69ff3284aa | |
parent | 168309855a7d1e16db751e9c647119fe2d2dc878 (diff) |
compat_ioctl: don't look up the fd twice
In code in fs/compat_ioctl.c that translates ioctl arguments
into a in-kernel structure, then performs sys_ioctl, possibly
under set_fs(KERNEL_DS), this commit changes the sys_ioctl
calls to do_ioctl calls. do_ioctl is a new function that does
the same thing as sys_ioctl, but doesn't look up the fd again.
This change is made to avoid (potential) security issues
because of ioctl handlers that accept one of the ioctl
commands I2C_FUNCS, VIDEO_GET_EVENT, MTIOCPOS, MTIOCGET,
TIOCGSERIAL, TIOCSSERIAL, RTC_IRQP_READ, RTC_EPOCH_READ.
This can happen for multiple reasons:
- The ioctl command number could be reused.
- The ioctl handler might not check the full ioctl
command. This is e.g. true for drm_ioctl.
- The ioctl handler is very special, e.g. cuse_file_ioctl
The real issue is that set_fs(KERNEL_DS) is used here,
but that's fixed in a separate commit
"compat_ioctl: don't call do_ioctl under set_fs(KERNEL_DS)".
This change mitigates potential security issues by
preventing a race that permits invocation of
unlocked_ioctl handlers under KERNEL_DS through compat
code even if a corresponding compat_ioctl handler exists.
So far, no way has been identified to use this to damage
kernel memory without having CAP_SYS_ADMIN in the init ns
(with the capability, doing reads/writes at arbitrary
kernel addresses should be easy through CUSE's ioctl
handler with FUSE_IOCTL_UNRESTRICTED set).
[AV: two missed sys_ioctl() taken care of]
Signed-off-by: Jann Horn <jann@thejh.net>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | fs/compat_ioctl.c | 122 |
1 files changed, 68 insertions, 54 deletions
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index dcf26537c935..06e60cab0c3b 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c | |||
@@ -115,15 +115,27 @@ | |||
115 | #include <asm/fbio.h> | 115 | #include <asm/fbio.h> |
116 | #endif | 116 | #endif |
117 | 117 | ||
118 | static int w_long(unsigned int fd, unsigned int cmd, | 118 | static int do_ioctl(struct file *file, unsigned int fd, |
119 | compat_ulong_t __user *argp) | 119 | unsigned int cmd, unsigned long arg) |
120 | { | ||
121 | int err; | ||
122 | |||
123 | err = security_file_ioctl(file, cmd, arg); | ||
124 | if (err) | ||
125 | return err; | ||
126 | |||
127 | return do_vfs_ioctl(file, fd, cmd, arg); | ||
128 | } | ||
129 | |||
130 | static int w_long(struct file *file, unsigned int fd, | ||
131 | unsigned int cmd, compat_ulong_t __user *argp) | ||
120 | { | 132 | { |
121 | mm_segment_t old_fs = get_fs(); | 133 | mm_segment_t old_fs = get_fs(); |
122 | int err; | 134 | int err; |
123 | unsigned long val; | 135 | unsigned long val; |
124 | 136 | ||
125 | set_fs (KERNEL_DS); | 137 | set_fs (KERNEL_DS); |
126 | err = sys_ioctl(fd, cmd, (unsigned long)&val); | 138 | err = do_ioctl(file, fd, cmd, (unsigned long)&val); |
127 | set_fs (old_fs); | 139 | set_fs (old_fs); |
128 | if (!err && put_user(val, argp)) | 140 | if (!err && put_user(val, argp)) |
129 | return -EFAULT; | 141 | return -EFAULT; |
@@ -139,15 +151,15 @@ struct compat_video_event { | |||
139 | } u; | 151 | } u; |
140 | }; | 152 | }; |
141 | 153 | ||
142 | static int do_video_get_event(unsigned int fd, unsigned int cmd, | 154 | static int do_video_get_event(struct file *file, unsigned int fd, |
143 | struct compat_video_event __user *up) | 155 | unsigned int cmd, struct compat_video_event __user *up) |
144 | { | 156 | { |
145 | struct video_event kevent; | 157 | struct video_event kevent; |
146 | mm_segment_t old_fs = get_fs(); | 158 | mm_segment_t old_fs = get_fs(); |
147 | int err; | 159 | int err; |
148 | 160 | ||
149 | set_fs(KERNEL_DS); | 161 | set_fs(KERNEL_DS); |
150 | err = sys_ioctl(fd, cmd, (unsigned long) &kevent); | 162 | err = do_ioctl(file, fd, cmd, (unsigned long) &kevent); |
151 | set_fs(old_fs); | 163 | set_fs(old_fs); |
152 | 164 | ||
153 | if (!err) { | 165 | if (!err) { |
@@ -169,8 +181,8 @@ struct compat_video_still_picture { | |||
169 | int32_t size; | 181 | int32_t size; |
170 | }; | 182 | }; |
171 | 183 | ||
172 | static int do_video_stillpicture(unsigned int fd, unsigned int cmd, | 184 | static int do_video_stillpicture(struct file *file, unsigned int fd, |
173 | struct compat_video_still_picture __user *up) | 185 | unsigned int cmd, struct compat_video_still_picture __user *up) |
174 | { | 186 | { |
175 | struct video_still_picture __user *up_native; | 187 | struct video_still_picture __user *up_native; |
176 | compat_uptr_t fp; | 188 | compat_uptr_t fp; |
@@ -190,7 +202,7 @@ static int do_video_stillpicture(unsigned int fd, unsigned int cmd, | |||
190 | if (err) | 202 | if (err) |
191 | return -EFAULT; | 203 | return -EFAULT; |
192 | 204 | ||
193 | err = sys_ioctl(fd, cmd, (unsigned long) up_native); | 205 | err = do_ioctl(file, fd, cmd, (unsigned long) up_native); |
194 | 206 | ||
195 | return err; | 207 | return err; |
196 | } | 208 | } |
@@ -200,8 +212,8 @@ struct compat_video_spu_palette { | |||
200 | compat_uptr_t palette; | 212 | compat_uptr_t palette; |
201 | }; | 213 | }; |
202 | 214 | ||
203 | static int do_video_set_spu_palette(unsigned int fd, unsigned int cmd, | 215 | static int do_video_set_spu_palette(struct file *file, unsigned int fd, |
204 | struct compat_video_spu_palette __user *up) | 216 | unsigned int cmd, struct compat_video_spu_palette __user *up) |
205 | { | 217 | { |
206 | struct video_spu_palette __user *up_native; | 218 | struct video_spu_palette __user *up_native; |
207 | compat_uptr_t palp; | 219 | compat_uptr_t palp; |
@@ -218,7 +230,7 @@ static int do_video_set_spu_palette(unsigned int fd, unsigned int cmd, | |||
218 | if (err) | 230 | if (err) |
219 | return -EFAULT; | 231 | return -EFAULT; |
220 | 232 | ||
221 | err = sys_ioctl(fd, cmd, (unsigned long) up_native); | 233 | err = do_ioctl(file, fd, cmd, (unsigned long) up_native); |
222 | 234 | ||
223 | return err; | 235 | return err; |
224 | } | 236 | } |
@@ -276,7 +288,7 @@ static int sg_build_iovec(sg_io_hdr_t __user *sgio, void __user *dxferp, u16 iov | |||
276 | return 0; | 288 | return 0; |
277 | } | 289 | } |
278 | 290 | ||
279 | static int sg_ioctl_trans(unsigned int fd, unsigned int cmd, | 291 | static int sg_ioctl_trans(struct file *file, unsigned int fd, unsigned int cmd, |
280 | sg_io_hdr32_t __user *sgio32) | 292 | sg_io_hdr32_t __user *sgio32) |
281 | { | 293 | { |
282 | sg_io_hdr_t __user *sgio; | 294 | sg_io_hdr_t __user *sgio; |
@@ -289,7 +301,7 @@ static int sg_ioctl_trans(unsigned int fd, unsigned int cmd, | |||
289 | if (get_user(interface_id, &sgio32->interface_id)) | 301 | if (get_user(interface_id, &sgio32->interface_id)) |
290 | return -EFAULT; | 302 | return -EFAULT; |
291 | if (interface_id != 'S') | 303 | if (interface_id != 'S') |
292 | return sys_ioctl(fd, cmd, (unsigned long)sgio32); | 304 | return do_ioctl(file, fd, cmd, (unsigned long)sgio32); |
293 | 305 | ||
294 | if (get_user(iovec_count, &sgio32->iovec_count)) | 306 | if (get_user(iovec_count, &sgio32->iovec_count)) |
295 | return -EFAULT; | 307 | return -EFAULT; |
@@ -349,7 +361,7 @@ static int sg_ioctl_trans(unsigned int fd, unsigned int cmd, | |||
349 | if (put_user(compat_ptr(data), &sgio->usr_ptr)) | 361 | if (put_user(compat_ptr(data), &sgio->usr_ptr)) |
350 | return -EFAULT; | 362 | return -EFAULT; |
351 | 363 | ||
352 | err = sys_ioctl(fd, cmd, (unsigned long) sgio); | 364 | err = do_ioctl(file, fd, cmd, (unsigned long) sgio); |
353 | 365 | ||
354 | if (err >= 0) { | 366 | if (err >= 0) { |
355 | void __user *datap; | 367 | void __user *datap; |
@@ -380,13 +392,13 @@ struct compat_sg_req_info { /* used by SG_GET_REQUEST_TABLE ioctl() */ | |||
380 | int unused; | 392 | int unused; |
381 | }; | 393 | }; |
382 | 394 | ||
383 | static int sg_grt_trans(unsigned int fd, unsigned int cmd, struct | 395 | static int sg_grt_trans(struct file *file, unsigned int fd, |
384 | compat_sg_req_info __user *o) | 396 | unsigned int cmd, struct compat_sg_req_info __user *o) |
385 | { | 397 | { |
386 | int err, i; | 398 | int err, i; |
387 | sg_req_info_t __user *r; | 399 | sg_req_info_t __user *r; |
388 | r = compat_alloc_user_space(sizeof(sg_req_info_t)*SG_MAX_QUEUE); | 400 | r = compat_alloc_user_space(sizeof(sg_req_info_t)*SG_MAX_QUEUE); |
389 | err = sys_ioctl(fd,cmd,(unsigned long)r); | 401 | err = do_ioctl(file, fd, cmd, (unsigned long)r); |
390 | if (err < 0) | 402 | if (err < 0) |
391 | return err; | 403 | return err; |
392 | for (i = 0; i < SG_MAX_QUEUE; i++) { | 404 | for (i = 0; i < SG_MAX_QUEUE; i++) { |
@@ -412,8 +424,8 @@ struct sock_fprog32 { | |||
412 | #define PPPIOCSPASS32 _IOW('t', 71, struct sock_fprog32) | 424 | #define PPPIOCSPASS32 _IOW('t', 71, struct sock_fprog32) |
413 | #define PPPIOCSACTIVE32 _IOW('t', 70, struct sock_fprog32) | 425 | #define PPPIOCSACTIVE32 _IOW('t', 70, struct sock_fprog32) |
414 | 426 | ||
415 | static int ppp_sock_fprog_ioctl_trans(unsigned int fd, unsigned int cmd, | 427 | static int ppp_sock_fprog_ioctl_trans(struct file *file, unsigned int fd, |
416 | struct sock_fprog32 __user *u_fprog32) | 428 | unsigned int cmd, struct sock_fprog32 __user *u_fprog32) |
417 | { | 429 | { |
418 | struct sock_fprog __user *u_fprog64 = compat_alloc_user_space(sizeof(struct sock_fprog)); | 430 | struct sock_fprog __user *u_fprog64 = compat_alloc_user_space(sizeof(struct sock_fprog)); |
419 | void __user *fptr64; | 431 | void __user *fptr64; |
@@ -435,7 +447,7 @@ static int ppp_sock_fprog_ioctl_trans(unsigned int fd, unsigned int cmd, | |||
435 | else | 447 | else |
436 | cmd = PPPIOCSACTIVE; | 448 | cmd = PPPIOCSACTIVE; |
437 | 449 | ||
438 | return sys_ioctl(fd, cmd, (unsigned long) u_fprog64); | 450 | return do_ioctl(file, fd, cmd, (unsigned long) u_fprog64); |
439 | } | 451 | } |
440 | 452 | ||
441 | struct ppp_option_data32 { | 453 | struct ppp_option_data32 { |
@@ -451,7 +463,7 @@ struct ppp_idle32 { | |||
451 | }; | 463 | }; |
452 | #define PPPIOCGIDLE32 _IOR('t', 63, struct ppp_idle32) | 464 | #define PPPIOCGIDLE32 _IOR('t', 63, struct ppp_idle32) |
453 | 465 | ||
454 | static int ppp_gidle(unsigned int fd, unsigned int cmd, | 466 | static int ppp_gidle(struct file *file, unsigned int fd, unsigned int cmd, |
455 | struct ppp_idle32 __user *idle32) | 467 | struct ppp_idle32 __user *idle32) |
456 | { | 468 | { |
457 | struct ppp_idle __user *idle; | 469 | struct ppp_idle __user *idle; |
@@ -460,7 +472,7 @@ static int ppp_gidle(unsigned int fd, unsigned int cmd, | |||
460 | 472 | ||
461 | idle = compat_alloc_user_space(sizeof(*idle)); | 473 | idle = compat_alloc_user_space(sizeof(*idle)); |
462 | 474 | ||
463 | err = sys_ioctl(fd, PPPIOCGIDLE, (unsigned long) idle); | 475 | err = do_ioctl(file, fd, PPPIOCGIDLE, (unsigned long) idle); |
464 | 476 | ||
465 | if (!err) { | 477 | if (!err) { |
466 | if (get_user(xmit, &idle->xmit_idle) || | 478 | if (get_user(xmit, &idle->xmit_idle) || |
@@ -472,7 +484,7 @@ static int ppp_gidle(unsigned int fd, unsigned int cmd, | |||
472 | return err; | 484 | return err; |
473 | } | 485 | } |
474 | 486 | ||
475 | static int ppp_scompress(unsigned int fd, unsigned int cmd, | 487 | static int ppp_scompress(struct file *file, unsigned int fd, unsigned int cmd, |
476 | struct ppp_option_data32 __user *odata32) | 488 | struct ppp_option_data32 __user *odata32) |
477 | { | 489 | { |
478 | struct ppp_option_data __user *odata; | 490 | struct ppp_option_data __user *odata; |
@@ -492,7 +504,7 @@ static int ppp_scompress(unsigned int fd, unsigned int cmd, | |||
492 | sizeof(__u32) + sizeof(int))) | 504 | sizeof(__u32) + sizeof(int))) |
493 | return -EFAULT; | 505 | return -EFAULT; |
494 | 506 | ||
495 | return sys_ioctl(fd, PPPIOCSCOMPRESS, (unsigned long) odata); | 507 | return do_ioctl(file, fd, PPPIOCSCOMPRESS, (unsigned long) odata); |
496 | } | 508 | } |
497 | 509 | ||
498 | #ifdef CONFIG_BLOCK | 510 | #ifdef CONFIG_BLOCK |
@@ -512,7 +524,8 @@ struct mtpos32 { | |||
512 | }; | 524 | }; |
513 | #define MTIOCPOS32 _IOR('m', 3, struct mtpos32) | 525 | #define MTIOCPOS32 _IOR('m', 3, struct mtpos32) |
514 | 526 | ||
515 | static int mt_ioctl_trans(unsigned int fd, unsigned int cmd, void __user *argp) | 527 | static int mt_ioctl_trans(struct file *file, unsigned int fd, |
528 | unsigned int cmd, void __user *argp) | ||
516 | { | 529 | { |
517 | mm_segment_t old_fs = get_fs(); | 530 | mm_segment_t old_fs = get_fs(); |
518 | struct mtget get; | 531 | struct mtget get; |
@@ -534,7 +547,7 @@ static int mt_ioctl_trans(unsigned int fd, unsigned int cmd, void __user *argp) | |||
534 | break; | 547 | break; |
535 | } | 548 | } |
536 | set_fs (KERNEL_DS); | 549 | set_fs (KERNEL_DS); |
537 | err = sys_ioctl (fd, kcmd, (unsigned long)karg); | 550 | err = do_ioctl(file, fd, kcmd, (unsigned long)karg); |
538 | set_fs (old_fs); | 551 | set_fs (old_fs); |
539 | if (err) | 552 | if (err) |
540 | return err; | 553 | return err; |
@@ -605,8 +618,8 @@ struct serial_struct32 { | |||
605 | compat_int_t reserved[1]; | 618 | compat_int_t reserved[1]; |
606 | }; | 619 | }; |
607 | 620 | ||
608 | static int serial_struct_ioctl(unsigned fd, unsigned cmd, | 621 | static int serial_struct_ioctl(struct file *file, unsigned fd, |
609 | struct serial_struct32 __user *ss32) | 622 | unsigned cmd, struct serial_struct32 __user *ss32) |
610 | { | 623 | { |
611 | typedef struct serial_struct32 SS32; | 624 | typedef struct serial_struct32 SS32; |
612 | int err; | 625 | int err; |
@@ -629,7 +642,7 @@ static int serial_struct_ioctl(unsigned fd, unsigned cmd, | |||
629 | ss.iomap_base = 0UL; | 642 | ss.iomap_base = 0UL; |
630 | } | 643 | } |
631 | set_fs(KERNEL_DS); | 644 | set_fs(KERNEL_DS); |
632 | err = sys_ioctl(fd,cmd,(unsigned long)(&ss)); | 645 | err = do_ioctl(file, fd, cmd, (unsigned long)&ss); |
633 | set_fs(oldseg); | 646 | set_fs(oldseg); |
634 | if (cmd == TIOCGSERIAL && err >= 0) { | 647 | if (cmd == TIOCGSERIAL && err >= 0) { |
635 | if (!access_ok(VERIFY_WRITE, ss32, sizeof(SS32))) | 648 | if (!access_ok(VERIFY_WRITE, ss32, sizeof(SS32))) |
@@ -674,8 +687,8 @@ struct i2c_rdwr_aligned { | |||
674 | struct i2c_msg msgs[0]; | 687 | struct i2c_msg msgs[0]; |
675 | }; | 688 | }; |
676 | 689 | ||
677 | static int do_i2c_rdwr_ioctl(unsigned int fd, unsigned int cmd, | 690 | static int do_i2c_rdwr_ioctl(struct file *file, unsigned int fd, |
678 | struct i2c_rdwr_ioctl_data32 __user *udata) | 691 | unsigned int cmd, struct i2c_rdwr_ioctl_data32 __user *udata) |
679 | { | 692 | { |
680 | struct i2c_rdwr_aligned __user *tdata; | 693 | struct i2c_rdwr_aligned __user *tdata; |
681 | struct i2c_msg __user *tmsgs; | 694 | struct i2c_msg __user *tmsgs; |
@@ -708,11 +721,11 @@ static int do_i2c_rdwr_ioctl(unsigned int fd, unsigned int cmd, | |||
708 | put_user(compat_ptr(datap), &tmsgs[i].buf)) | 721 | put_user(compat_ptr(datap), &tmsgs[i].buf)) |
709 | return -EFAULT; | 722 | return -EFAULT; |
710 | } | 723 | } |
711 | return sys_ioctl(fd, cmd, (unsigned long)tdata); | 724 | return do_ioctl(file, fd, cmd, (unsigned long)tdata); |
712 | } | 725 | } |
713 | 726 | ||
714 | static int do_i2c_smbus_ioctl(unsigned int fd, unsigned int cmd, | 727 | static int do_i2c_smbus_ioctl(struct file *file, unsigned int fd, |
715 | struct i2c_smbus_ioctl_data32 __user *udata) | 728 | unsigned int cmd, struct i2c_smbus_ioctl_data32 __user *udata) |
716 | { | 729 | { |
717 | struct i2c_smbus_ioctl_data __user *tdata; | 730 | struct i2c_smbus_ioctl_data __user *tdata; |
718 | compat_caddr_t datap; | 731 | compat_caddr_t datap; |
@@ -734,7 +747,7 @@ static int do_i2c_smbus_ioctl(unsigned int fd, unsigned int cmd, | |||
734 | __put_user(compat_ptr(datap), &tdata->data)) | 747 | __put_user(compat_ptr(datap), &tdata->data)) |
735 | return -EFAULT; | 748 | return -EFAULT; |
736 | 749 | ||
737 | return sys_ioctl(fd, cmd, (unsigned long)tdata); | 750 | return do_ioctl(file, fd, cmd, (unsigned long)tdata); |
738 | } | 751 | } |
739 | 752 | ||
740 | #define RTC_IRQP_READ32 _IOR('p', 0x0b, compat_ulong_t) | 753 | #define RTC_IRQP_READ32 _IOR('p', 0x0b, compat_ulong_t) |
@@ -742,7 +755,8 @@ static int do_i2c_smbus_ioctl(unsigned int fd, unsigned int cmd, | |||
742 | #define RTC_EPOCH_READ32 _IOR('p', 0x0d, compat_ulong_t) | 755 | #define RTC_EPOCH_READ32 _IOR('p', 0x0d, compat_ulong_t) |
743 | #define RTC_EPOCH_SET32 _IOW('p', 0x0e, compat_ulong_t) | 756 | #define RTC_EPOCH_SET32 _IOW('p', 0x0e, compat_ulong_t) |
744 | 757 | ||
745 | static int rtc_ioctl(unsigned fd, unsigned cmd, void __user *argp) | 758 | static int rtc_ioctl(struct file *file, unsigned fd, |
759 | unsigned cmd, void __user *argp) | ||
746 | { | 760 | { |
747 | mm_segment_t oldfs = get_fs(); | 761 | mm_segment_t oldfs = get_fs(); |
748 | compat_ulong_t val32; | 762 | compat_ulong_t val32; |
@@ -753,7 +767,7 @@ static int rtc_ioctl(unsigned fd, unsigned cmd, void __user *argp) | |||
753 | case RTC_IRQP_READ32: | 767 | case RTC_IRQP_READ32: |
754 | case RTC_EPOCH_READ32: | 768 | case RTC_EPOCH_READ32: |
755 | set_fs(KERNEL_DS); | 769 | set_fs(KERNEL_DS); |
756 | ret = sys_ioctl(fd, (cmd == RTC_IRQP_READ32) ? | 770 | ret = do_ioctl(file, fd, (cmd == RTC_IRQP_READ32) ? |
757 | RTC_IRQP_READ : RTC_EPOCH_READ, | 771 | RTC_IRQP_READ : RTC_EPOCH_READ, |
758 | (unsigned long)&kval); | 772 | (unsigned long)&kval); |
759 | set_fs(oldfs); | 773 | set_fs(oldfs); |
@@ -762,9 +776,9 @@ static int rtc_ioctl(unsigned fd, unsigned cmd, void __user *argp) | |||
762 | val32 = kval; | 776 | val32 = kval; |
763 | return put_user(val32, (unsigned int __user *)argp); | 777 | return put_user(val32, (unsigned int __user *)argp); |
764 | case RTC_IRQP_SET32: | 778 | case RTC_IRQP_SET32: |
765 | return sys_ioctl(fd, RTC_IRQP_SET, (unsigned long)argp); | 779 | return do_ioctl(file, fd, RTC_IRQP_SET, (unsigned long)argp); |
766 | case RTC_EPOCH_SET32: | 780 | case RTC_EPOCH_SET32: |
767 | return sys_ioctl(fd, RTC_EPOCH_SET, (unsigned long)argp); | 781 | return do_ioctl(file, fd, RTC_EPOCH_SET, (unsigned long)argp); |
768 | } | 782 | } |
769 | 783 | ||
770 | return -ENOIOCTLCMD; | 784 | return -ENOIOCTLCMD; |
@@ -1443,46 +1457,46 @@ static long do_ioctl_trans(int fd, unsigned int cmd, | |||
1443 | 1457 | ||
1444 | switch (cmd) { | 1458 | switch (cmd) { |
1445 | case PPPIOCGIDLE32: | 1459 | case PPPIOCGIDLE32: |
1446 | return ppp_gidle(fd, cmd, argp); | 1460 | return ppp_gidle(file, fd, cmd, argp); |
1447 | case PPPIOCSCOMPRESS32: | 1461 | case PPPIOCSCOMPRESS32: |
1448 | return ppp_scompress(fd, cmd, argp); | 1462 | return ppp_scompress(file, fd, cmd, argp); |
1449 | case PPPIOCSPASS32: | 1463 | case PPPIOCSPASS32: |
1450 | case PPPIOCSACTIVE32: | 1464 | case PPPIOCSACTIVE32: |
1451 | return ppp_sock_fprog_ioctl_trans(fd, cmd, argp); | 1465 | return ppp_sock_fprog_ioctl_trans(file, fd, cmd, argp); |
1452 | #ifdef CONFIG_BLOCK | 1466 | #ifdef CONFIG_BLOCK |
1453 | case SG_IO: | 1467 | case SG_IO: |
1454 | return sg_ioctl_trans(fd, cmd, argp); | 1468 | return sg_ioctl_trans(file, fd, cmd, argp); |
1455 | case SG_GET_REQUEST_TABLE: | 1469 | case SG_GET_REQUEST_TABLE: |
1456 | return sg_grt_trans(fd, cmd, argp); | 1470 | return sg_grt_trans(file, fd, cmd, argp); |
1457 | case MTIOCGET32: | 1471 | case MTIOCGET32: |
1458 | case MTIOCPOS32: | 1472 | case MTIOCPOS32: |
1459 | return mt_ioctl_trans(fd, cmd, argp); | 1473 | return mt_ioctl_trans(file, fd, cmd, argp); |
1460 | #endif | 1474 | #endif |
1461 | /* Serial */ | 1475 | /* Serial */ |
1462 | case TIOCGSERIAL: | 1476 | case TIOCGSERIAL: |
1463 | case TIOCSSERIAL: | 1477 | case TIOCSSERIAL: |
1464 | return serial_struct_ioctl(fd, cmd, argp); | 1478 | return serial_struct_ioctl(file, fd, cmd, argp); |
1465 | /* i2c */ | 1479 | /* i2c */ |
1466 | case I2C_FUNCS: | 1480 | case I2C_FUNCS: |
1467 | return w_long(fd, cmd, argp); | 1481 | return w_long(file, fd, cmd, argp); |
1468 | case I2C_RDWR: | 1482 | case I2C_RDWR: |
1469 | return do_i2c_rdwr_ioctl(fd, cmd, argp); | 1483 | return do_i2c_rdwr_ioctl(file, fd, cmd, argp); |
1470 | case I2C_SMBUS: | 1484 | case I2C_SMBUS: |
1471 | return do_i2c_smbus_ioctl(fd, cmd, argp); | 1485 | return do_i2c_smbus_ioctl(file, fd, cmd, argp); |
1472 | /* Not implemented in the native kernel */ | 1486 | /* Not implemented in the native kernel */ |
1473 | case RTC_IRQP_READ32: | 1487 | case RTC_IRQP_READ32: |
1474 | case RTC_IRQP_SET32: | 1488 | case RTC_IRQP_SET32: |
1475 | case RTC_EPOCH_READ32: | 1489 | case RTC_EPOCH_READ32: |
1476 | case RTC_EPOCH_SET32: | 1490 | case RTC_EPOCH_SET32: |
1477 | return rtc_ioctl(fd, cmd, argp); | 1491 | return rtc_ioctl(file, fd, cmd, argp); |
1478 | 1492 | ||
1479 | /* dvb */ | 1493 | /* dvb */ |
1480 | case VIDEO_GET_EVENT: | 1494 | case VIDEO_GET_EVENT: |
1481 | return do_video_get_event(fd, cmd, argp); | 1495 | return do_video_get_event(file, fd, cmd, argp); |
1482 | case VIDEO_STILLPICTURE: | 1496 | case VIDEO_STILLPICTURE: |
1483 | return do_video_stillpicture(fd, cmd, argp); | 1497 | return do_video_stillpicture(file, fd, cmd, argp); |
1484 | case VIDEO_SET_SPU_PALETTE: | 1498 | case VIDEO_SET_SPU_PALETTE: |
1485 | return do_video_set_spu_palette(fd, cmd, argp); | 1499 | return do_video_set_spu_palette(file, fd, cmd, argp); |
1486 | } | 1500 | } |
1487 | 1501 | ||
1488 | /* | 1502 | /* |