Series short description
Subsystems (6)
cover Series short description
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(-)
Signature · 2 lines
Take control of enterprise infrastructure Sign up for starfleet academy today
PATCH 1/8 tty: Fix race in the flush for some ldiscs
From: Alan Cox <[email protected]>
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
---
drivers/char/tty_ioctl.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/char/tty_ioctl.c +1 -1
@@ -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)
PATCH 2/8 8250_pci: add support for netmos 9835 IBM devices
In reply to Alan CoxFrom: Jiri Slaby <[email protected]>
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.
---
drivers/serial/8250_pci.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
drivers/serial/8250_pci.c +8 -0
@@ -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
PATCH 3/8 serial: Add SupraExpress 336i PnP Voice Modem
In reply to Alan CoxFrom: Daniel Gagnon <[email protected]>
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
---
drivers/serial/8250_pnp.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/serial/8250_pnp.c +2 -0
@@ -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 */
PATCH 4/8 When a break signal is detected, the next character should be ignored.
In reply to Alan CoxFrom: Mischa Jonker <[email protected]>
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.
]
---
drivers/serial/pnx8xxx_uart.c | 23 ++++++++++++----------- 1 files changed, 12 insertions(+), 11 deletions(-)
drivers/serial/pnx8xxx_uart.c +12 -11
@@ -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 */
PATCH 5/8 ftdi_sio: fix kref leak
In reply to Alan CoxFrom: Jim Paris <[email protected]>
Commit 4a90f09b20f4622dcbff1f0e1e6bae1704f8ad8c added kref stuff to ftdi_sio, but missed tty_kref_put at one exit point in ftdi_process_read.
---
drivers/usb/serial/ftdi_sio.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/usb/serial/ftdi_sio.c +1 -1
@@ -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 */
PATCH 6/8 tty: Fix a kref leak in the HSO driver on re-open
In reply to Alan CoxFrom: Alan Cox <[email protected]>
---
drivers/net/usb/hso.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/net/usb/hso.c +1 -0
@@ -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);
PATCH 7/8 tty: Fix double grabbing of a spinlock
In reply to Alan CoxFrom: Denis Joseph Barrow <[email protected]>
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]
---
drivers/net/usb/hso.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
drivers/net/usb/hso.c +1 -2
@@ -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) {
PATCH 8/8 hso serial throttled tty kref fix.
In reply to Alan CoxFrom: Denis Joseph Barrow <[email protected]>
This patch is for Alan Cox as it related to the tty layer. Hopefully the hso driver is again relatively stable with this fix.
---
drivers/net/usb/hso.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/net/usb/hso.c +3 -1
@@ -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,