mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/8] Series short description
@ 2009-01-15 13:29 Alan Cox
  2009-01-15 13:30 ` [PATCH 1/8] tty: Fix race in the flush for some ldiscs Alan Cox
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Alan Cox @ 2009-01-15 13:29 UTC (permalink / raw)
  To: torvalds, linux-kernel

Assorted small tty fixes, mostly for the HSO driver which appears not to have
been my finest conversion.

---

Alan Cox (2):
      tty: Fix a kref leak in the HSO driver on re-open
      tty: Fix race in the flush for some ldiscs

Daniel Gagnon (1):
      serial: Add SupraExpress 336i PnP Voice Modem

Denis Joseph Barrow (2):
      hso serial throttled tty kref fix.
      tty: Fix double grabbing of a spinlock

Jim Paris (1):
      ftdi_sio: fix kref leak

Jiri Slaby (1):
      8250_pci: add support for netmos 9835 IBM devices

Mischa Jonker (1):
      When a break signal is detected, the next character should be ignored.


 drivers/char/tty_ioctl.c      |    2 +-
 drivers/net/usb/hso.c         |    8 +++++---
 drivers/serial/8250_pci.c     |    8 ++++++++
 drivers/serial/8250_pnp.c     |    2 ++
 drivers/serial/pnx8xxx_uart.c |   23 ++++++++++++-----------
 drivers/usb/serial/ftdi_sio.c |    2 +-
 6 files changed, 29 insertions(+), 16 deletions(-)

-- 
		Take control of enterprise infrastructure
		   Sign up for starfleet academy today


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/8] tty: Fix race in the flush for some ldiscs
  2009-01-15 13:29 [PATCH 0/8] Series short description Alan Cox
@ 2009-01-15 13:30 ` Alan Cox
  2009-01-15 13:30 ` [PATCH 2/8] 8250_pci: add support for netmos 9835 IBM devices Alan Cox
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Alan Cox @ 2009-01-15 13:30 UTC (permalink / raw)
  To: torvalds, linux-kernel

From: Alan Cox <alan@redhat.com>

If you issue an ioctl to flush a tty as the line discipline is changing or
otherwise unplugged you can get a crash. The bug is very old but the rest
of the BKL lock dropping and some very "good" luck on Ingo's part caught
an example.

Use the correct ldisc_ref form so that we wait for the ldisc change to
complete and then flush

Signed-off-by: Alan Cox <alan@redhat.com>
---

 drivers/char/tty_ioctl.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


diff --git a/drivers/char/tty_ioctl.c b/drivers/char/tty_ioctl.c
index a408c8e..6f4c7d0 100644
--- a/drivers/char/tty_ioctl.c
+++ b/drivers/char/tty_ioctl.c
@@ -1057,7 +1057,7 @@ int tty_perform_flush(struct tty_struct *tty, unsigned long arg)
 	if (retval)
 		return retval;
 
-	ld = tty_ldisc_ref(tty);
+	ld = tty_ldisc_ref_wait(tty);
 	switch (arg) {
 	case TCIFLUSH:
 		if (ld && ld->ops->flush_buffer)


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 2/8] 8250_pci: add support for netmos 9835 IBM devices
  2009-01-15 13:29 [PATCH 0/8] Series short description Alan Cox
  2009-01-15 13:30 ` [PATCH 1/8] tty: Fix race in the flush for some ldiscs Alan Cox
@ 2009-01-15 13:30 ` Alan Cox
  2009-01-15 13:30 ` [PATCH 3/8] serial: Add SupraExpress 336i PnP Voice Modem Alan Cox
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Alan Cox @ 2009-01-15 13:30 UTC (permalink / raw)
  To: torvalds, linux-kernel

From: Jiri Slaby <jirislaby@gmail.com>

Most of netmos 9835 hardware is handled by parport-serial.  IBM introduces
a device which doesn't have any parallel ports and have screwed subdevice
PCI id (not corresponding to port numbers).

Handle this device (9710:9835 1014:0299) properly.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Alan Cox <alan@redhat.com>
---

 drivers/serial/8250_pci.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)


diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c
index c088146..2a36712 100644
--- a/drivers/serial/8250_pci.c
+++ b/drivers/serial/8250_pci.c
@@ -602,6 +602,10 @@ static int pci_netmos_init(struct pci_dev *dev)
 	/* subdevice 0x00PS means <P> parallel, <S> serial */
 	unsigned int num_serial = dev->subsystem_device & 0xf;
 
+	if (dev->subsystem_vendor == PCI_VENDOR_ID_IBM &&
+			dev->subsystem_device == 0x0299)
+		return 0;
+
 	if (num_serial == 0)
 		return -ENODEV;
 	return num_serial;
@@ -3096,6 +3100,10 @@ static struct pci_device_id serial_pci_tbl[] = {
 		0,
 		pbn_b0_8_115200 },
 
+	{	PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9835,
+		PCI_VENDOR_ID_IBM, 0x0299,
+		0, 0, pbn_b0_bt_2_115200 },
+
 	/*
 	 * These entries match devices with class COMMUNICATION_SERIAL,
 	 * COMMUNICATION_MODEM or COMMUNICATION_MULTISERIAL


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 3/8] serial: Add SupraExpress 336i PnP Voice Modem
  2009-01-15 13:29 [PATCH 0/8] Series short description Alan Cox
  2009-01-15 13:30 ` [PATCH 1/8] tty: Fix race in the flush for some ldiscs Alan Cox
  2009-01-15 13:30 ` [PATCH 2/8] 8250_pci: add support for netmos 9835 IBM devices Alan Cox
@ 2009-01-15 13:30 ` Alan Cox
  2009-01-15 13:30 ` [PATCH 4/8] When a break signal is detected, the next character should be ignored Alan Cox
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Alan Cox @ 2009-01-15 13:30 UTC (permalink / raw)
  To: torvalds, linux-kernel

From: Daniel Gagnon <daniel.gagnon@yahoo.com>

Add SupraExpress 336i PnP Voice Modem

Tested and working with the following device: (output from lspnp -v)
01:01.00 SUP1381 (unknown)
    state = active
	io 0x2f8-0x2ff
	irq 3

Signed-off-by: Daniel Gagnon <daniel.gagnon@yahoo.com>
Signed-off-by: Alan Cox <alan@redhat.com>
---

 drivers/serial/8250_pnp.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)


diff --git a/drivers/serial/8250_pnp.c b/drivers/serial/8250_pnp.c
index fde7f9c..bbcfc26 100644
--- a/drivers/serial/8250_pnp.c
+++ b/drivers/serial/8250_pnp.c
@@ -270,6 +270,8 @@ static const struct pnp_device_id pnp_dev_table[] = {
 	{       "RSS0250",              0       },
 	/* SupraExpress 28.8 Data/Fax PnP modem */
 	{	"SUP1310",		0	},
+	/* SupraExpress 336i PnP Voice Modem */
+	{	"SUP1381",		0	},
 	/* SupraExpress 33.6 Data/Fax PnP modem */
 	{	"SUP1421",		0	},
 	/* SupraExpress 33.6 Data/Fax PnP modem */


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 4/8] When a break signal is detected, the next character should be ignored.
  2009-01-15 13:29 [PATCH 0/8] Series short description Alan Cox
                   ` (2 preceding siblings ...)
  2009-01-15 13:30 ` [PATCH 3/8] serial: Add SupraExpress 336i PnP Voice Modem Alan Cox
@ 2009-01-15 13:30 ` Alan Cox
  2009-01-15 13:31 ` [PATCH 5/8] ftdi_sio: fix kref leak Alan Cox
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Alan Cox @ 2009-01-15 13:30 UTC (permalink / raw)
  To: torvalds, linux-kernel

From: Mischa Jonker <mischa.jonker@nxp.com>

This was not implemented correctly for the pnx8xxx_uart driver.

[From further discussion:
Correct, you can look to it as two separate bugs:
a) the next character is not ignored while it should;
b) the status bits 31-8 are copied to the 'ch' variable while they shouldn't.

Both bugs prevent correct break signal handling (and therefore correct
behaviour of the magic SysRq key). Bug b didn't cause too much trouble
earlier because in most situations the status bits are all zero; for
this case they unfortunately aren't.
]

Signed-off-by: Mischa Jonker <mischa.jonker@nxp.com>
Signed-off-by: Alan Cox <alan@redhat.com>
---

 drivers/serial/pnx8xxx_uart.c |   23 ++++++++++++-----------
 1 files changed, 12 insertions(+), 11 deletions(-)


diff --git a/drivers/serial/pnx8xxx_uart.c b/drivers/serial/pnx8xxx_uart.c
index 22e30d2..1bb8f1b 100644
--- a/drivers/serial/pnx8xxx_uart.c
+++ b/drivers/serial/pnx8xxx_uart.c
@@ -187,7 +187,7 @@ static void pnx8xxx_rx_chars(struct pnx8xxx_port *sport)
 	status = FIFO_TO_SM(serial_in(sport, PNX8XXX_FIFO)) |
 		 ISTAT_TO_SM(serial_in(sport, PNX8XXX_ISTAT));
 	while (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFIFO)) {
-		ch = serial_in(sport, PNX8XXX_FIFO);
+		ch = serial_in(sport, PNX8XXX_FIFO) & 0xff;
 
 		sport->port.icount.rx++;
 
@@ -198,9 +198,16 @@ static void pnx8xxx_rx_chars(struct pnx8xxx_port *sport)
 		 * out of the main execution path
 		 */
 		if (status & (FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFE |
-					PNX8XXX_UART_FIFO_RXPAR) |
+					PNX8XXX_UART_FIFO_RXPAR |
+					PNX8XXX_UART_FIFO_RXBRK) |
 			      ISTAT_TO_SM(PNX8XXX_UART_INT_RXOVRN))) {
-			if (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXPAR))
+			if (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXBRK)) {
+				status &= ~(FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFE) |
+					FIFO_TO_SM(PNX8XXX_UART_FIFO_RXPAR));
+				sport->port.icount.brk++;
+				if (uart_handle_break(&sport->port))
+					goto ignore_char;
+			} else if (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXPAR))
 				sport->port.icount.parity++;
 			else if (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFE))
 				sport->port.icount.frame++;
@@ -284,14 +291,8 @@ static irqreturn_t pnx8xxx_int(int irq, void *dev_id)
 	/* Get the interrupts */
 	status  = serial_in(sport, PNX8XXX_ISTAT) & serial_in(sport, PNX8XXX_IEN);
 
-	/* Break signal received */
-	if (status & PNX8XXX_UART_INT_BREAK) {
-		sport->port.icount.brk++;
-		uart_handle_break(&sport->port);
-	}
-
-	/* Byte received */
-	if (status & PNX8XXX_UART_INT_RX)
+	/* Byte or break signal received */
+	if (status & (PNX8XXX_UART_INT_RX | PNX8XXX_UART_INT_BREAK))
 		pnx8xxx_rx_chars(sport);
 
 	/* TX holding register empty - transmit a byte */


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 5/8] ftdi_sio: fix kref leak
  2009-01-15 13:29 [PATCH 0/8] Series short description Alan Cox
                   ` (3 preceding siblings ...)
  2009-01-15 13:30 ` [PATCH 4/8] When a break signal is detected, the next character should be ignored Alan Cox
@ 2009-01-15 13:31 ` Alan Cox
  2009-01-15 13:31 ` [PATCH 6/8] tty: Fix a kref leak in the HSO driver on re-open Alan Cox
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Alan Cox @ 2009-01-15 13:31 UTC (permalink / raw)
  To: torvalds, linux-kernel

From: Jim Paris <jim@jtan.com>

Commit 4a90f09b20f4622dcbff1f0e1e6bae1704f8ad8c added kref stuff to
ftdi_sio, but missed tty_kref_put at one exit point in
ftdi_process_read.

Signed-off-by: Jim Paris <jim@jtan.com>
Signed-off-by: Alan Cox <alan@redhat.com>
---

 drivers/usb/serial/ftdi_sio.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index ef6cfa5..c70a8f6 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -2030,7 +2030,7 @@ static void ftdi_process_read(struct work_struct *work)
 			spin_unlock_irqrestore(&priv->rx_lock, flags);
 			dbg("%s - deferring remainder until unthrottled",
 					__func__);
-			return;
+			goto out;
 		}
 		spin_unlock_irqrestore(&priv->rx_lock, flags);
 		/* if the port is closed stop trying to read */


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 6/8] tty: Fix a kref leak in the HSO driver on re-open
  2009-01-15 13:29 [PATCH 0/8] Series short description Alan Cox
                   ` (4 preceding siblings ...)
  2009-01-15 13:31 ` [PATCH 5/8] ftdi_sio: fix kref leak Alan Cox
@ 2009-01-15 13:31 ` Alan Cox
  2009-01-15 13:31 ` [PATCH 7/8] tty: Fix double grabbing of a spinlock Alan Cox
  2009-01-15 13:31 ` [PATCH 8/8] hso serial throttled tty kref fix Alan Cox
  7 siblings, 0 replies; 9+ messages in thread
From: Alan Cox @ 2009-01-15 13:31 UTC (permalink / raw)
  To: torvalds, linux-kernel

From: Alan Cox <alan@redhat.com>


---

 drivers/net/usb/hso.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)


diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index c4918b8..9df04dd 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -1297,6 +1297,7 @@ static int hso_serial_open(struct tty_struct *tty, struct file *filp)
 	/* setup */
 	spin_lock_irq(&serial->serial_lock);
 	tty->driver_data = serial;
+	tty_kref_put(serial->tty);
 	serial->tty = tty_kref_get(tty);
 	spin_unlock_irq(&serial->serial_lock);
 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 7/8] tty: Fix double grabbing of a spinlock
  2009-01-15 13:29 [PATCH 0/8] Series short description Alan Cox
                   ` (5 preceding siblings ...)
  2009-01-15 13:31 ` [PATCH 6/8] tty: Fix a kref leak in the HSO driver on re-open Alan Cox
@ 2009-01-15 13:31 ` Alan Cox
  2009-01-15 13:31 ` [PATCH 8/8] hso serial throttled tty kref fix Alan Cox
  7 siblings, 0 replies; 9+ messages in thread
From: Alan Cox @ 2009-01-15 13:31 UTC (permalink / raw)
  To: torvalds, linux-kernel

From: Denis Joseph Barrow <D.Barrow@option.com>

The HSO changes for kref introduced a recursive spinlock take. All
functions which call put_rxbuf_data already have serial->serial_lock
grabbed.

[Comment to code added-AC]

Signed-off-by: Denis Joseph Barrow <D.Barrow@option.com>
Signed-off-by: Alan Cox <alan@redhat.com>
---

 drivers/net/usb/hso.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)


diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index 9df04dd..e25a58f 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -2044,9 +2044,8 @@ static int put_rxbuf_data(struct urb *urb, struct hso_serial *serial)
 		return -2;
 	}
 
-	spin_lock(&serial->serial_lock);
+	/* All callers to put_rxbuf_data hold serial_lock */
 	tty = tty_kref_get(serial->tty);
-	spin_unlock(&serial->serial_lock);
 
 	/* Push data to tty */
 	if (tty) {


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 8/8] hso serial throttled tty kref fix.
  2009-01-15 13:29 [PATCH 0/8] Series short description Alan Cox
                   ` (6 preceding siblings ...)
  2009-01-15 13:31 ` [PATCH 7/8] tty: Fix double grabbing of a spinlock Alan Cox
@ 2009-01-15 13:31 ` Alan Cox
  7 siblings, 0 replies; 9+ messages in thread
From: Alan Cox @ 2009-01-15 13:31 UTC (permalink / raw)
  To: torvalds, linux-kernel

From: Denis Joseph Barrow <D.Barow@option.com>

This patch is for Alan Cox as it related to the tty layer.
Hopefully the hso driver is again relatively stable with this fix.

Signed-off-by: Denis Joseph Barrow <D.Barow@option.com>
Signed-off-by: Alan Cox <alan@redhat.com>
---

 drivers/net/usb/hso.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)


diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index e25a58f..6478bf6 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -2053,8 +2053,10 @@ static int put_rxbuf_data(struct urb *urb, struct hso_serial *serial)
 			serial->curr_rx_urb_offset;
 		D1("data to push to tty");
 		while (write_length_remaining) {
-			if (test_bit(TTY_THROTTLED, &tty->flags))
+			if (test_bit(TTY_THROTTLED, &tty->flags)) {
+				tty_kref_put(tty);
 				return -1;
+			}
 			curr_write_len =  tty_insert_flip_string
 				(tty, urb->transfer_buffer +
 				 serial->curr_rx_urb_offset,


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2009-01-15 13:33 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-15 13:29 [PATCH 0/8] Series short description Alan Cox
2009-01-15 13:30 ` [PATCH 1/8] tty: Fix race in the flush for some ldiscs Alan Cox
2009-01-15 13:30 ` [PATCH 2/8] 8250_pci: add support for netmos 9835 IBM devices Alan Cox
2009-01-15 13:30 ` [PATCH 3/8] serial: Add SupraExpress 336i PnP Voice Modem Alan Cox
2009-01-15 13:30 ` [PATCH 4/8] When a break signal is detected, the next character should be ignored Alan Cox
2009-01-15 13:31 ` [PATCH 5/8] ftdi_sio: fix kref leak Alan Cox
2009-01-15 13:31 ` [PATCH 6/8] tty: Fix a kref leak in the HSO driver on re-open Alan Cox
2009-01-15 13:31 ` [PATCH 7/8] tty: Fix double grabbing of a spinlock Alan Cox
2009-01-15 13:31 ` [PATCH 8/8] hso serial throttled tty kref fix Alan Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome