[PATCH 2/3] tty - fix tty network driver interactions with TCGET/TCSET calls

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We conciously make a change here - we permit mode and speed setting to be
done in things like SLIP mode. There isn't actually a technical reason to
disallow this. It's usually a silly thing to do but we can do it and
soemone might wish to do so.

Signed-off-by: Alan Cox <[email protected]>

diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.24-rc1/drivers/net/hamradio/6pack.c linux-2.6.24-rc1/drivers/net/hamradio/6pack.c
--- linux.vanilla-2.6.24-rc1/drivers/net/hamradio/6pack.c	2007-11-01 11:41:56.000000000 +0000
+++ linux-2.6.24-rc1/drivers/net/hamradio/6pack.c	2007-11-02 12:09:17.000000000 +0000
@@ -762,26 +762,20 @@
 
 		if (copy_from_user(&addr,
 		                   (void __user *) arg, AX25_ADDR_LEN)) {
-			err = -EFAULT;
-			break;
-		}
+				err = -EFAULT;
+				break;
+			}
 
-		netif_tx_lock_bh(dev);
-		memcpy(dev->dev_addr, &addr, AX25_ADDR_LEN);
-		netif_tx_unlock_bh(dev);
+			netif_tx_lock_bh(dev);
+			memcpy(dev->dev_addr, &addr, AX25_ADDR_LEN);
+			netif_tx_unlock_bh(dev);
 
-		err = 0;
-		break;
-	}
-
-	/* Allow stty to read, but not set, the serial port */
-	case TCGETS:
-	case TCGETA:
-		err = n_tty_ioctl(tty, (struct file *) file, cmd, arg);
-		break;
+			err = 0;
+			break;
+		}
 
 	default:
-		err = -ENOIOCTLCMD;
+		err = tty_mode_ioctl(tty, file, cmd, arg);
 	}
 
 	sp_put(sp);
diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.24-rc1/drivers/net/irda/irtty-sir.c linux-2.6.24-rc1/drivers/net/irda/irtty-sir.c
--- linux.vanilla-2.6.24-rc1/drivers/net/irda/irtty-sir.c	2007-11-01 11:41:56.000000000 +0000
+++ linux-2.6.24-rc1/drivers/net/irda/irtty-sir.c	2007-11-02 12:16:13.837586480 +0000
@@ -434,11 +434,6 @@
 	IRDA_ASSERT(dev != NULL, return -1;);
 
 	switch (cmd) {
-	case TCGETS:
-	case TCGETA:
-		err = n_tty_ioctl(tty, file, cmd, arg);
-		break;
-
 	case IRTTY_IOCTDONGLE:
 		/* this call blocks for completion */
 		err = sirdev_set_dongle(dev, (IRDA_DONGLE) arg);
@@ -454,7 +449,7 @@
 			err = -EFAULT;
 		break;
 	default:
-		err = -ENOIOCTLCMD;
+		err = tty_mode_ioctl(tty, file, cmd, arg);
 		break;
 	}
 	return err;
diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.24-rc1/drivers/net/ppp_async.c linux-2.6.24-rc1/drivers/net/ppp_async.c
--- linux.vanilla-2.6.24-rc1/drivers/net/ppp_async.c	2007-11-01 11:41:18.000000000 +0000
+++ linux-2.6.24-rc1/drivers/net/ppp_async.c	2007-11-01 22:29:06.574077296 +0000
@@ -309,16 +309,11 @@
 		err = 0;
 		break;
 
-	case TCGETS:
-	case TCGETA:
-		err = n_tty_ioctl(tty, file, cmd, arg);
-		break;
-
 	case TCFLSH:
 		/* flush our buffers and the serial port's buffer */
 		if (arg == TCIOFLUSH || arg == TCOFLUSH)
 			ppp_async_flush_output(ap);
-		err = n_tty_ioctl(tty, file, cmd, arg);
+		err = tty_perform_flush(tty, arg);
 		break;
 
 	case FIONREAD:
@@ -329,7 +324,8 @@
 		break;
 
 	default:
-		err = -ENOIOCTLCMD;
+		/* Try the various mode ioctls */
+		err = tty_mode_ioctl(tty, file, cmd, arg);
 	}
 
 	ap_put(ap);
diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.24-rc1/drivers/net/ppp_synctty.c linux-2.6.24-rc1/drivers/net/ppp_synctty.c
--- linux.vanilla-2.6.24-rc1/drivers/net/ppp_synctty.c	2007-11-01 11:41:18.000000000 +0000
+++ linux-2.6.24-rc1/drivers/net/ppp_synctty.c	2007-11-02 12:07:18.873913320 +0000
@@ -349,16 +349,11 @@
 		err = 0;
 		break;
 
-	case TCGETS:
-	case TCGETA:
-		err = n_tty_ioctl(tty, file, cmd, arg);
-		break;
-
 	case TCFLSH:
 		/* flush our buffers and the serial port's buffer */
 		if (arg == TCIOFLUSH || arg == TCOFLUSH)
 			ppp_sync_flush_output(ap);
-		err = n_tty_ioctl(tty, file, cmd, arg);
+		err = tty_perform_flush(tty, arg);
 		break;
 
 	case FIONREAD:
@@ -369,7 +364,8 @@
 		break;
 
 	default:
-		err = -ENOIOCTLCMD;
+		err = tty_mode_ioctl(tty, file, cmd, arg);
+		break;
 	}
 
 	sp_put(ap);
diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.24-rc1/drivers/net/slip.c linux-2.6.24-rc1/drivers/net/slip.c
--- linux.vanilla-2.6.24-rc1/drivers/net/slip.c	2007-11-01 11:41:56.000000000 +0000
+++ linux-2.6.24-rc1/drivers/net/slip.c	2007-11-02 12:08:18.000000000 +0000
@@ -1218,14 +1218,8 @@
 		return 0;
 	/* VSV changes end */
 #endif
-
-	/* Allow stty to read, but not set, the serial port */
-	case TCGETS:
-	case TCGETA:
-		return n_tty_ioctl(tty, file, cmd, arg);
-
 	default:
-		return -ENOIOCTLCMD;
+		return tty_mode_ioctl(tty, file, cmd, arg);
 	}
 }
 
diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.24-rc1/drivers/net/wan/x25_asy.c linux-2.6.24-rc1/drivers/net/wan/x25_asy.c
--- linux.vanilla-2.6.24-rc1/drivers/net/wan/x25_asy.c	2007-11-01 11:41:18.000000000 +0000
+++ linux-2.6.24-rc1/drivers/net/wan/x25_asy.c	2007-11-02 12:14:34.000000000 +0000
@@ -719,12 +719,8 @@
 		return 0;
 	case SIOCSIFHWADDR:
 		return -EINVAL;
-	/* Allow stty to read, but not set, the serial port */
-	case TCGETS:
-	case TCGETA:
-		return n_tty_ioctl(tty, file, cmd, arg);
 	default:
-		return -ENOIOCTLCMD;
+		return tty_mode_ioctl(tty, file, cmd, arg);
 	}
 }
 
diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.24-rc1/drivers/net/wireless/strip.c linux-2.6.24-rc1/drivers/net/wireless/strip.c
--- linux.vanilla-2.6.24-rc1/drivers/net/wireless/strip.c	2007-11-01 11:41:56.000000000 +0000
+++ linux-2.6.24-rc1/drivers/net/wireless/strip.c	2007-11-02 12:14:08.434650624 +0000
@@ -2735,16 +2735,8 @@
 			return -EFAULT;
 		return set_mac_address(strip_info, &addr);
 	}
-	/*
-	 * Allow stty to read, but not set, the serial port
-	 */
-
-	case TCGETS:
-	case TCGETA:
-		return n_tty_ioctl(tty, file, cmd, arg);
-		break;
 	default:
-		return -ENOIOCTLCMD;
+		return tty_mode_ioctl(tty, file, cmd, arg);
 		break;
 	}
 	return 0;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux