|
28 | 28 | #include <linux/mount.h>
|
29 | 29 | #include <linux/file.h>
|
30 | 30 | #include <linux/ioctl.h>
|
| 31 | +#include <linux/compat.h> |
31 | 32 |
|
32 | 33 | #undef TTY_DEBUG_HANGUP
|
33 | 34 | #ifdef TTY_DEBUG_HANGUP
|
@@ -488,15 +489,19 @@ static int pty_bsd_ioctl(struct tty_struct *tty,
|
488 | 489 | return -ENOIOCTLCMD;
|
489 | 490 | }
|
490 | 491 |
|
| 492 | +#ifdef CONFIG_COMPAT |
491 | 493 | static long pty_bsd_compat_ioctl(struct tty_struct *tty,
|
492 | 494 | unsigned int cmd, unsigned long arg)
|
493 | 495 | {
|
494 | 496 | /*
|
495 | 497 | * PTY ioctls don't require any special translation between 32-bit and
|
496 | 498 | * 64-bit userspace, they are already compatible.
|
497 | 499 | */
|
498 |
| - return pty_bsd_ioctl(tty, cmd, arg); |
| 500 | + return pty_bsd_ioctl(tty, cmd, (unsigned long)compat_ptr(arg)); |
499 | 501 | }
|
| 502 | +#else |
| 503 | +#define pty_bsd_compat_ioctl NULL |
| 504 | +#endif |
500 | 505 |
|
501 | 506 | static int legacy_count = CONFIG_LEGACY_PTY_COUNT;
|
502 | 507 | /*
|
@@ -676,15 +681,20 @@ static int pty_unix98_ioctl(struct tty_struct *tty,
|
676 | 681 | return -ENOIOCTLCMD;
|
677 | 682 | }
|
678 | 683 |
|
| 684 | +#ifdef CONFIG_COMPAT |
679 | 685 | static long pty_unix98_compat_ioctl(struct tty_struct *tty,
|
680 | 686 | unsigned int cmd, unsigned long arg)
|
681 | 687 | {
|
682 | 688 | /*
|
683 | 689 | * PTY ioctls don't require any special translation between 32-bit and
|
684 | 690 | * 64-bit userspace, they are already compatible.
|
685 | 691 | */
|
686 |
| - return pty_unix98_ioctl(tty, cmd, arg); |
| 692 | + return pty_unix98_ioctl(tty, cmd, |
| 693 | + cmd == TIOCSIG ? arg : (unsigned long)compat_ptr(arg)); |
687 | 694 | }
|
| 695 | +#else |
| 696 | +#define pty_unix98_compat_ioctl NULL |
| 697 | +#endif |
688 | 698 |
|
689 | 699 | /**
|
690 | 700 | * ptm_unix98_lookup - find a pty master
|
|
0 commit comments