Skip to content

Commit

Permalink
Merge tag 'tty-5.0-rc6' of git://git.kernel.org/pub/scm/linux/kernel/…
Browse files Browse the repository at this point in the history
…git/gregkh/tty

Pull tty/serial fixes from Greg KH:
 "Here are some small tty and serial fixes for 5.0-rc6.

  Nothing huge, just a few small fixes for reported issues. The speakup
  fix is in here as it is a tty operation issue.

  All of these have been in linux-next for a while with no reported
  problems"

* tag 'tty-5.0-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
  serial: fix race between flush_to_ldisc and tty_open
  staging: speakup: fix tty-operation NULL derefs
  serial: sh-sci: Do not free irqs that have already been freed
  serial: 8250_pci: Make PCI class test non fatal
  tty: serial: 8250_mtk: Fix potential NULL pointer dereference
  • Loading branch information
Linus Torvalds committed Feb 8, 2019
2 parents 00a159a + fedb576 commit e22a15d
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 7 deletions.
6 changes: 4 additions & 2 deletions drivers/staging/speakup/spk_ttyio.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,8 @@ static void spk_ttyio_send_xchar(char ch)
return;
}

speakup_tty->ops->send_xchar(speakup_tty, ch);
if (speakup_tty->ops->send_xchar)
speakup_tty->ops->send_xchar(speakup_tty, ch);
mutex_unlock(&speakup_tty_mutex);
}

Expand All @@ -277,7 +278,8 @@ static void spk_ttyio_tiocmset(unsigned int set, unsigned int clear)
return;
}

speakup_tty->ops->tiocmset(speakup_tty, set, clear);
if (speakup_tty->ops->tiocmset)
speakup_tty->ops->tiocmset(speakup_tty, set, clear);
mutex_unlock(&speakup_tty_mutex);
}

Expand Down
3 changes: 3 additions & 0 deletions drivers/tty/serial/8250/8250_mtk.c
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,9 @@ static int mtk8250_probe_of(struct platform_device *pdev, struct uart_port *p,
if (dmacnt == 2) {
data->dma = devm_kzalloc(&pdev->dev, sizeof(*data->dma),
GFP_KERNEL);
if (!data->dma)
return -ENOMEM;

data->dma->fn = mtk8250_dma_filter;
data->dma->rx_size = MTK_UART_RX_SIZE;
data->dma->rxconf.src_maxburst = MTK_UART_RX_TRIGGER;
Expand Down
9 changes: 5 additions & 4 deletions drivers/tty/serial/8250/8250_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -3420,6 +3420,11 @@ static int
serial_pci_guess_board(struct pci_dev *dev, struct pciserial_board *board)
{
int num_iomem, num_port, first_port = -1, i;
int rc;

rc = serial_pci_is_class_communication(dev);
if (rc)
return rc;

/*
* Should we try to make guesses for multiport serial devices later?
Expand Down Expand Up @@ -3647,10 +3652,6 @@ pciserial_init_one(struct pci_dev *dev, const struct pci_device_id *ent)

board = &pci_boards[ent->driver_data];

rc = serial_pci_is_class_communication(dev);
if (rc)
return rc;

rc = serial_pci_is_blacklisted(dev);
if (rc)
return rc;
Expand Down
6 changes: 6 additions & 0 deletions drivers/tty/serial/serial_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ static void uart_start(struct tty_struct *tty)
struct uart_port *port;
unsigned long flags;

if (!state)
return;

port = uart_port_lock(state, flags);
__uart_start(tty);
uart_port_unlock(port, flags);
Expand Down Expand Up @@ -727,6 +730,9 @@ static void uart_unthrottle(struct tty_struct *tty)
upstat_t mask = UPSTAT_SYNC_FIFO;
struct uart_port *port;

if (!state)
return;

port = uart_port_ref(state);
if (!port)
return;
Expand Down
9 changes: 8 additions & 1 deletion drivers/tty/serial/sh-sci.c
Original file line number Diff line number Diff line change
Expand Up @@ -1921,7 +1921,7 @@ static int sci_request_irq(struct sci_port *port)

static void sci_free_irq(struct sci_port *port)
{
int i;
int i, j;

/*
* Intentionally in reverse order so we iterate over the muxed
Expand All @@ -1937,6 +1937,13 @@ static void sci_free_irq(struct sci_port *port)
if (unlikely(irq < 0))
continue;

/* Check if already freed (irq was muxed) */
for (j = 0; j < i; j++)
if (port->irqs[j] == irq)
j = i + 1;
if (j > i)
continue;

free_irq(port->irqs[i], port);
kfree(port->irqstr[i]);

Expand Down

0 comments on commit e22a15d

Please sign in to comment.