diff options
author | Arnd Bergmann <arnd@arndb.de> | 2009-11-07 01:51:16 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-11-07 01:52:38 -0500 |
commit | 9646e7ce3d1955478aa0573b36c151ab4b649486 (patch) | |
tree | ecef431218a43293cf0b71eec52427b20f618b02 /drivers/net/wan/x25_asy.c | |
parent | 50857e2a59d8beddc6bb76137df026d67f30d5ca (diff) |
net, compat_ioctl: handle socket ioctl abuses in tty drivers
Slip and a few other drivers use the same ioctl numbers on
tty devices that are normally meant for sockets. This causes
problems with our compat_ioctl handling that tries to convert
the data structures in a different format.
Fortunately, these five drivers all use 32 bit compatible
data structures in the ioctl numbers, so we can just add
a trivial compat_ioctl conversion function to each of them.
SIOCSIFENCAP and SIOCGIFENCAP do not need to live in
fs/compat_ioctl.c after this any more, and they are not
used on any sockets.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/wan/x25_asy.c')
-rw-r--r-- | drivers/net/wan/x25_asy.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/net/wan/x25_asy.c b/drivers/net/wan/x25_asy.c index 27945049c9e1..3c325d77939b 100644 --- a/drivers/net/wan/x25_asy.c +++ b/drivers/net/wan/x25_asy.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/lapb.h> | 33 | #include <linux/lapb.h> |
34 | #include <linux/init.h> | 34 | #include <linux/init.h> |
35 | #include <linux/rtnetlink.h> | 35 | #include <linux/rtnetlink.h> |
36 | #include <linux/compat.h> | ||
36 | #include "x25_asy.h" | 37 | #include "x25_asy.h" |
37 | 38 | ||
38 | #include <net/x25device.h> | 39 | #include <net/x25device.h> |
@@ -705,6 +706,21 @@ static int x25_asy_ioctl(struct tty_struct *tty, struct file *file, | |||
705 | } | 706 | } |
706 | } | 707 | } |
707 | 708 | ||
709 | #ifdef CONFIG_COMPAT | ||
710 | static long x25_asy_compat_ioctl(struct tty_struct *tty, struct file *file, | ||
711 | unsigned int cmd, unsigned long arg) | ||
712 | { | ||
713 | switch (cmd) { | ||
714 | case SIOCGIFNAME: | ||
715 | case SIOCSIFHWADDR: | ||
716 | return x25_asy_ioctl(tty, file, cmd, | ||
717 | (unsigned long)compat_ptr(arg)); | ||
718 | } | ||
719 | |||
720 | return -ENOIOCTLCMD; | ||
721 | } | ||
722 | #endif | ||
723 | |||
708 | static int x25_asy_open_dev(struct net_device *dev) | 724 | static int x25_asy_open_dev(struct net_device *dev) |
709 | { | 725 | { |
710 | struct x25_asy *sl = netdev_priv(dev); | 726 | struct x25_asy *sl = netdev_priv(dev); |
@@ -754,6 +770,9 @@ static struct tty_ldisc_ops x25_ldisc = { | |||
754 | .open = x25_asy_open_tty, | 770 | .open = x25_asy_open_tty, |
755 | .close = x25_asy_close_tty, | 771 | .close = x25_asy_close_tty, |
756 | .ioctl = x25_asy_ioctl, | 772 | .ioctl = x25_asy_ioctl, |
773 | #ifdef CONFIG_COMPAT | ||
774 | .compat_ioctl = x25_asy_compat_ioctl, | ||
775 | #endif | ||
757 | .receive_buf = x25_asy_receive_buf, | 776 | .receive_buf = x25_asy_receive_buf, |
758 | .write_wakeup = x25_asy_write_wakeup, | 777 | .write_wakeup = x25_asy_write_wakeup, |
759 | }; | 778 | }; |