aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/hamradio/mkiss.c
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2009-11-07 01:51:16 -0500
committerDavid S. Miller <davem@davemloft.net>2009-11-07 01:52:38 -0500
commit9646e7ce3d1955478aa0573b36c151ab4b649486 (patch)
treeecef431218a43293cf0b71eec52427b20f618b02 /drivers/net/hamradio/mkiss.c
parent50857e2a59d8beddc6bb76137df026d67f30d5ca (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/hamradio/mkiss.c')
-rw-r--r--drivers/net/hamradio/mkiss.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c
index db4b7f1603f6..fc9c57893f8a 100644
--- a/drivers/net/hamradio/mkiss.c
+++ b/drivers/net/hamradio/mkiss.c
@@ -36,6 +36,7 @@
36#include <linux/skbuff.h> 36#include <linux/skbuff.h>
37#include <linux/if_arp.h> 37#include <linux/if_arp.h>
38#include <linux/jiffies.h> 38#include <linux/jiffies.h>
39#include <linux/compat.h>
39 40
40#include <net/ax25.h> 41#include <net/ax25.h>
41 42
@@ -898,6 +899,23 @@ static int mkiss_ioctl(struct tty_struct *tty, struct file *file,
898 return err; 899 return err;
899} 900}
900 901
902#ifdef CONFIG_COMPAT
903static long mkiss_compat_ioctl(struct tty_struct *tty, struct file *file,
904 unsigned int cmd, unsigned long arg)
905{
906 switch (arg) {
907 case SIOCGIFNAME:
908 case SIOCGIFENCAP:
909 case SIOCSIFENCAP:
910 case SIOCSIFHWADDR:
911 return mkiss_ioctl(tty, file, cmd,
912 (unsigned long)compat_ptr(arg));
913 }
914
915 return -ENOIOCTLCMD;
916}
917#endif
918
901/* 919/*
902 * Handle the 'receiver data ready' interrupt. 920 * Handle the 'receiver data ready' interrupt.
903 * This function is called by the 'tty_io' module in the kernel when 921 * This function is called by the 'tty_io' module in the kernel when
@@ -972,6 +990,9 @@ static struct tty_ldisc_ops ax_ldisc = {
972 .open = mkiss_open, 990 .open = mkiss_open,
973 .close = mkiss_close, 991 .close = mkiss_close,
974 .ioctl = mkiss_ioctl, 992 .ioctl = mkiss_ioctl,
993#ifdef CONFIG_COMPAT
994 .compat_ioctl = mkiss_compat_ioctl,
995#endif
975 .receive_buf = mkiss_receive_buf, 996 .receive_buf = mkiss_receive_buf,
976 .write_wakeup = mkiss_write_wakeup 997 .write_wakeup = mkiss_write_wakeup
977}; 998};