Skip to content

Commit 44adbac

Browse files
committed
Merge branch 'work.tty-ioctl' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull tty ioctl updates from Al Viro: "This is the compat_ioctl work related to tty ioctls. Quite a bit of dead code taken out, all tty-related stuff gone from fs/compat_ioctl.c. A bunch of compat bugs fixed - some still remain, but all more or less generic tty-related ioctls should be covered (remaining issues are in things like driver-private ioctls in a pcmcia serial card driver not getting properly handled in 32bit processes on 64bit host, etc)" * 'work.tty-ioctl' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (53 commits) kill TIOCSERGSTRUCT change semantics of ldisc ->compat_ioctl() kill TIOCSER[SG]WILD synclink_gt(): fix compat_ioctl() pty: fix compat ioctls compat_ioctl - kill keyboard ioctl handling gigaset: add ->compat_ioctl() vt_compat_ioctl(): clean up, use compat_ptr() properly gigaset: don't try to printk userland buffer contents dgnc: don't bother with (empty) stub for TCXONC dgnc: leave TIOC[GS]SOFTCAR to ldisc remove fallback to drivers for TIOCGICOUNT dgnc: break-related ioctls won't reach ->ioctl() kill the rest of tty COMPAT_IOCTL() entries dgnc: TIOCM... won't reach ->ioctl() isdn_tty: TCSBRK{,P} won't reach ->ioctl() kill capinc_tty_ioctl() take compat TIOC[SG]SERIAL treatment into tty_compat_ioctl() synclink: reduce pointless checks in ->ioctl() complete ->[sg]et_serial() switchover ...
2 parents 08ffb58 + ce5a983 commit 44adbac

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+779
-1522
lines changed

arch/ia64/hp/sim/simserial.c

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -297,29 +297,29 @@ static void rs_unthrottle(struct tty_struct * tty)
297297
printk(KERN_INFO "simrs_unthrottle called\n");
298298
}
299299

300+
static int rs_setserial(struct tty_struct *tty, struct serial_struct *ss)
301+
{
302+
return 0;
303+
}
304+
305+
static int rs_getserial(struct tty_struct *tty, struct serial_struct *ss)
306+
{
307+
return 0;
308+
}
309+
300310
static int rs_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg)
301311
{
302-
if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) &&
303-
(cmd != TIOCSERCONFIG) && (cmd != TIOCSERGSTRUCT) &&
304-
(cmd != TIOCMIWAIT)) {
312+
if ((cmd != TIOCSERCONFIG) && (cmd != TIOCMIWAIT)) {
305313
if (tty_io_error(tty))
306314
return -EIO;
307315
}
308316

309317
switch (cmd) {
310-
case TIOCGSERIAL:
311-
case TIOCSSERIAL:
312-
case TIOCSERGSTRUCT:
313318
case TIOCMIWAIT:
314319
return 0;
315320
case TIOCSERCONFIG:
316321
case TIOCSERGETLSR: /* Get line status register */
317322
return -EINVAL;
318-
case TIOCSERGWILD:
319-
case TIOCSERSWILD:
320-
/* "setserial -W" is called in Debian boot */
321-
printk (KERN_INFO "TIOCSER?WILD ioctl obsolete, ignored.\n");
322-
return 0;
323323
}
324324
return -ENOIOCTLCMD;
325325
}
@@ -448,6 +448,8 @@ static const struct tty_operations hp_ops = {
448448
.throttle = rs_throttle,
449449
.unthrottle = rs_unthrottle,
450450
.send_xchar = rs_send_xchar,
451+
.set_serial = rs_setserial,
452+
.get_serial = rs_getserial,
451453
.hangup = rs_hangup,
452454
.proc_show = rs_proc_show,
453455
};

drivers/bluetooth/hci_ldisc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -823,6 +823,7 @@ static int __init hci_uart_init(void)
823823
hci_uart_ldisc.read = hci_uart_tty_read;
824824
hci_uart_ldisc.write = hci_uart_tty_write;
825825
hci_uart_ldisc.ioctl = hci_uart_tty_ioctl;
826+
hci_uart_ldisc.compat_ioctl = hci_uart_tty_ioctl;
826827
hci_uart_ldisc.poll = hci_uart_tty_poll;
827828
hci_uart_ldisc.receive_buf = hci_uart_tty_receive;
828829
hci_uart_ldisc.write_wakeup = hci_uart_tty_wakeup;

drivers/char/pcmcia/synclink_cs.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2237,8 +2237,7 @@ static int mgslpc_ioctl(struct tty_struct *tty,
22372237
if (mgslpc_paranoia_check(info, tty->name, "mgslpc_ioctl"))
22382238
return -ENODEV;
22392239

2240-
if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) &&
2241-
(cmd != TIOCMIWAIT)) {
2240+
if (cmd != TIOCMIWAIT) {
22422241
if (tty_io_error(tty))
22432242
return -EIO;
22442243
}

drivers/input/serio/serport.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ static int serport_ldisc_ioctl(struct tty_struct *tty, struct file *file,
226226

227227
#ifdef CONFIG_COMPAT
228228
#define COMPAT_SPIOCSTYPE _IOW('q', 0x01, compat_ulong_t)
229-
static long serport_ldisc_compat_ioctl(struct tty_struct *tty,
229+
static int serport_ldisc_compat_ioctl(struct tty_struct *tty,
230230
struct file *file,
231231
unsigned int cmd, unsigned long arg)
232232
{

drivers/isdn/capi/capi.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,12 +1155,6 @@ static int capinc_tty_chars_in_buffer(struct tty_struct *tty)
11551155
return mp->outbytes;
11561156
}
11571157

1158-
static int capinc_tty_ioctl(struct tty_struct *tty,
1159-
unsigned int cmd, unsigned long arg)
1160-
{
1161-
return -ENOIOCTLCMD;
1162-
}
1163-
11641158
static void capinc_tty_set_termios(struct tty_struct *tty, struct ktermios *old)
11651159
{
11661160
pr_debug("capinc_tty_set_termios\n");
@@ -1236,7 +1230,6 @@ static const struct tty_operations capinc_ops = {
12361230
.flush_chars = capinc_tty_flush_chars,
12371231
.write_room = capinc_tty_write_room,
12381232
.chars_in_buffer = capinc_tty_chars_in_buffer,
1239-
.ioctl = capinc_tty_ioctl,
12401233
.set_termios = capinc_tty_set_termios,
12411234
.throttle = capinc_tty_throttle,
12421235
.unthrottle = capinc_tty_unthrottle,

drivers/isdn/gigaset/interface.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ static int if_ioctl(struct tty_struct *tty,
206206
? -EFAULT : 0;
207207
if (retval >= 0) {
208208
gigaset_dbg_buffer(DEBUG_IF, "GIGASET_BRKCHARS",
209-
6, (const unsigned char *) arg);
209+
6, buf);
210210
retval = cs->ops->brkchars(cs, buf);
211211
}
212212
break;
@@ -233,6 +233,14 @@ static int if_ioctl(struct tty_struct *tty,
233233
return retval;
234234
}
235235

236+
#ifdef CONFIG_COMPAT
237+
static long if_compat_ioctl(struct tty_struct *tty,
238+
unsigned int cmd, unsigned long arg)
239+
{
240+
return if_ioctl(tty, cmd, (unsigned long)compat_ptr(arg));
241+
}
242+
#endif
243+
236244
static int if_tiocmget(struct tty_struct *tty)
237245
{
238246
struct cardstate *cs = tty->driver_data;
@@ -472,6 +480,9 @@ static const struct tty_operations if_ops = {
472480
.open = if_open,
473481
.close = if_close,
474482
.ioctl = if_ioctl,
483+
#ifdef CONFIG_COMPAT
484+
.compat_ioctl = if_compat_ioctl,
485+
#endif
475486
.write = if_write,
476487
.write_room = if_write_room,
477488
.chars_in_buffer = if_chars_in_buffer,

drivers/isdn/i4l/isdn_tty.c

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1412,31 +1412,12 @@ static int
14121412
isdn_tty_ioctl(struct tty_struct *tty, uint cmd, ulong arg)
14131413
{
14141414
modem_info *info = (modem_info *) tty->driver_data;
1415-
int retval;
14161415

14171416
if (isdn_tty_paranoia_check(info, tty->name, "isdn_tty_ioctl"))
14181417
return -ENODEV;
14191418
if (tty_io_error(tty))
14201419
return -EIO;
14211420
switch (cmd) {
1422-
case TCSBRK: /* SVID version: non-zero arg --> no break */
1423-
#ifdef ISDN_DEBUG_MODEM_IOCTL
1424-
printk(KERN_DEBUG "ttyI%d ioctl TCSBRK\n", info->line);
1425-
#endif
1426-
retval = tty_check_change(tty);
1427-
if (retval)
1428-
return retval;
1429-
tty_wait_until_sent(tty, 0);
1430-
return 0;
1431-
case TCSBRKP: /* support for POSIX tcsendbreak() */
1432-
#ifdef ISDN_DEBUG_MODEM_IOCTL
1433-
printk(KERN_DEBUG "ttyI%d ioctl TCSBRKP\n", info->line);
1434-
#endif
1435-
retval = tty_check_change(tty);
1436-
if (retval)
1437-
return retval;
1438-
tty_wait_until_sent(tty, 0);
1439-
return 0;
14401421
case TIOCSERGETLSR: /* Get line status register */
14411422
#ifdef ISDN_DEBUG_MODEM_IOCTL
14421423
printk(KERN_DEBUG "ttyI%d ioctl TIOCSERGETLSR\n", info->line);

drivers/net/hamradio/6pack.c

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
#include <linux/ip.h>
3535
#include <linux/tcp.h>
3636
#include <linux/semaphore.h>
37-
#include <linux/compat.h>
3837
#include <linux/refcount.h>
3938

4039
#define SIXPACK_VERSION "Revision: 0.3.0"
@@ -752,33 +751,13 @@ static int sixpack_ioctl(struct tty_struct *tty, struct file *file,
752751
return err;
753752
}
754753

755-
#ifdef CONFIG_COMPAT
756-
static long sixpack_compat_ioctl(struct tty_struct * tty, struct file * file,
757-
unsigned int cmd, unsigned long arg)
758-
{
759-
switch (cmd) {
760-
case SIOCGIFNAME:
761-
case SIOCGIFENCAP:
762-
case SIOCSIFENCAP:
763-
case SIOCSIFHWADDR:
764-
return sixpack_ioctl(tty, file, cmd,
765-
(unsigned long)compat_ptr(arg));
766-
}
767-
768-
return -ENOIOCTLCMD;
769-
}
770-
#endif
771-
772754
static struct tty_ldisc_ops sp_ldisc = {
773755
.owner = THIS_MODULE,
774756
.magic = TTY_LDISC_MAGIC,
775757
.name = "6pack",
776758
.open = sixpack_open,
777759
.close = sixpack_close,
778760
.ioctl = sixpack_ioctl,
779-
#ifdef CONFIG_COMPAT
780-
.compat_ioctl = sixpack_compat_ioctl,
781-
#endif
782761
.receive_buf = sixpack_receive_buf,
783762
.write_wakeup = sixpack_write_wakeup,
784763
};

drivers/net/hamradio/mkiss.c

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
#include <linux/skbuff.h>
3636
#include <linux/if_arp.h>
3737
#include <linux/jiffies.h>
38-
#include <linux/compat.h>
3938

4039
#include <net/ax25.h>
4140

@@ -875,23 +874,6 @@ static int mkiss_ioctl(struct tty_struct *tty, struct file *file,
875874
return err;
876875
}
877876

878-
#ifdef CONFIG_COMPAT
879-
static long mkiss_compat_ioctl(struct tty_struct *tty, struct file *file,
880-
unsigned int cmd, unsigned long arg)
881-
{
882-
switch (cmd) {
883-
case SIOCGIFNAME:
884-
case SIOCGIFENCAP:
885-
case SIOCSIFENCAP:
886-
case SIOCSIFHWADDR:
887-
return mkiss_ioctl(tty, file, cmd,
888-
(unsigned long)compat_ptr(arg));
889-
}
890-
891-
return -ENOIOCTLCMD;
892-
}
893-
#endif
894-
895877
/*
896878
* Handle the 'receiver data ready' interrupt.
897879
* This function is called by the 'tty_io' module in the kernel when
@@ -966,9 +948,6 @@ static struct tty_ldisc_ops ax_ldisc = {
966948
.open = mkiss_open,
967949
.close = mkiss_close,
968950
.ioctl = mkiss_ioctl,
969-
#ifdef CONFIG_COMPAT
970-
.compat_ioctl = mkiss_compat_ioctl,
971-
#endif
972951
.receive_buf = mkiss_receive_buf,
973952
.write_wakeup = mkiss_write_wakeup
974953
};

drivers/net/slip/slip.c

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@
7979
#include <linux/rtnetlink.h>
8080
#include <linux/if_arp.h>
8181
#include <linux/if_slip.h>
82-
#include <linux/compat.h>
8382
#include <linux/delay.h>
8483
#include <linux/init.h>
8584
#include <linux/slab.h>
@@ -1167,27 +1166,6 @@ static int slip_ioctl(struct tty_struct *tty, struct file *file,
11671166
}
11681167
}
11691168

1170-
#ifdef CONFIG_COMPAT
1171-
static long slip_compat_ioctl(struct tty_struct *tty, struct file *file,
1172-
unsigned int cmd, unsigned long arg)
1173-
{
1174-
switch (cmd) {
1175-
case SIOCGIFNAME:
1176-
case SIOCGIFENCAP:
1177-
case SIOCSIFENCAP:
1178-
case SIOCSIFHWADDR:
1179-
case SIOCSKEEPALIVE:
1180-
case SIOCGKEEPALIVE:
1181-
case SIOCSOUTFILL:
1182-
case SIOCGOUTFILL:
1183-
return slip_ioctl(tty, file, cmd,
1184-
(unsigned long)compat_ptr(arg));
1185-
}
1186-
1187-
return -ENOIOCTLCMD;
1188-
}
1189-
#endif
1190-
11911169
/* VSV changes start here */
11921170
#ifdef CONFIG_SLIP_SMART
11931171
/* function do_ioctl called from net/core/dev.c
@@ -1280,9 +1258,6 @@ static struct tty_ldisc_ops sl_ldisc = {
12801258
.close = slip_close,
12811259
.hangup = slip_hangup,
12821260
.ioctl = slip_ioctl,
1283-
#ifdef CONFIG_COMPAT
1284-
.compat_ioctl = slip_compat_ioctl,
1285-
#endif
12861261
.receive_buf = slip_receive_buf,
12871262
.write_wakeup = slip_write_wakeup,
12881263
};

drivers/net/wan/x25_asy.c

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
#include <linux/lapb.h>
3434
#include <linux/init.h>
3535
#include <linux/rtnetlink.h>
36-
#include <linux/compat.h>
3736
#include <linux/slab.h>
3837
#include <net/x25device.h>
3938
#include "x25_asy.h"
@@ -703,21 +702,6 @@ static int x25_asy_ioctl(struct tty_struct *tty, struct file *file,
703702
}
704703
}
705704

706-
#ifdef CONFIG_COMPAT
707-
static long x25_asy_compat_ioctl(struct tty_struct *tty, struct file *file,
708-
unsigned int cmd, unsigned long arg)
709-
{
710-
switch (cmd) {
711-
case SIOCGIFNAME:
712-
case SIOCSIFHWADDR:
713-
return x25_asy_ioctl(tty, file, cmd,
714-
(unsigned long)compat_ptr(arg));
715-
}
716-
717-
return -ENOIOCTLCMD;
718-
}
719-
#endif
720-
721705
static int x25_asy_open_dev(struct net_device *dev)
722706
{
723707
struct x25_asy *sl = netdev_priv(dev);
@@ -769,9 +753,6 @@ static struct tty_ldisc_ops x25_ldisc = {
769753
.open = x25_asy_open_tty,
770754
.close = x25_asy_close_tty,
771755
.ioctl = x25_asy_ioctl,
772-
#ifdef CONFIG_COMPAT
773-
.compat_ioctl = x25_asy_compat_ioctl,
774-
#endif
775756
.receive_buf = x25_asy_receive_buf,
776757
.write_wakeup = x25_asy_write_wakeup,
777758
};

0 commit comments

Comments
 (0)