Commit c5f33785 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull tty/serial fixes from Greg KH:
 "Here are some tty and serial driver fixes for 5.7-rc3.

  The "largest" in here are a number of reverts for previous changes to
  the uartps serial driver that turned out to not be a good idea at all.

  The others are just small fixes found by people and tools. Included in
  here is a much-reported symbol export needed by previous changes that
  happened in 5.7-rc1. All of these have been in linux-next for a while
  with no reported issues"

* tag 'tty-5.7-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
  tty: hvc: fix buffer overflow during hvc_alloc().
  tty: rocket, avoid OOB access
  tty: serial: bcm63xx: fix missing clk_put() in bcm63xx_uart
  vt: don't hardcode the mem allocation upper bound
  tty: serial: owl: add "much needed" clk_prepare_enable()
  vt: don't use kmalloc() for the unicode screen buffer
  tty/sysrq: Export sysrq_mask(), sysrq_toggle_support()
  serial: sh-sci: Make sure status register SCxSR is read in correct sequence
  serial: sunhv: Initialize lock for non-registered console
  Revert "serial: uartps: Register own uart console and driver structures"
  Revert "serial: uartps: Move Port ID to device data structure"
  Revert "serial: uartps: Change uart ID port allocation"
  Revert "serial: uartps: Do not allow use aliases >= MAX_UART_INSTANCES"
  Revert "serial: uartps: Fix error path when alloc failed"
  Revert "serial: uartps: Use the same dynamic major number for all ports"
  Revert "serial: uartps: Fix uartps_major handling"
parents f6da8bd1 9a9fc42b
Loading
Loading
Loading
Loading
+14 −9
Original line number Diff line number Diff line
@@ -302,10 +302,6 @@ int hvc_instantiate(uint32_t vtermno, int index, const struct hv_ops *ops)
	vtermnos[index] = vtermno;
	cons_ops[index] = ops;

	/* reserve all indices up to and including this index */
	if (last_hvc < index)
		last_hvc = index;

	/* check if we need to re-register the kernel console */
	hvc_check_console(index);

@@ -960,13 +956,22 @@ struct hvc_struct *hvc_alloc(uint32_t vtermno, int data,
		    cons_ops[i] == hp->ops)
			break;

	if (i >= MAX_NR_HVC_CONSOLES) {

		/* find 'empty' slot for console */
		for (i = 0; i < MAX_NR_HVC_CONSOLES && vtermnos[i] != -1; i++) {
		}

		/* no matching slot, just use a counter */
	if (i >= MAX_NR_HVC_CONSOLES)
		i = ++last_hvc;
		if (i == MAX_NR_HVC_CONSOLES)
			i = ++last_hvc + MAX_NR_HVC_CONSOLES;
	}

	hp->index = i;
	if (i < MAX_NR_HVC_CONSOLES) {
		cons_ops[i] = ops;
		vtermnos[i] = vtermno;
	}

	list_add_tail(&(hp->next), &hvc_structs);
	mutex_unlock(&hvc_structs_mutex);
+14 −11
Original line number Diff line number Diff line
@@ -632,6 +632,7 @@ init_r_port(int board, int aiop, int chan, struct pci_dev *pci_dev)
	tty_port_init(&info->port);
	info->port.ops = &rocket_port_ops;
	info->flags &= ~ROCKET_MODE_MASK;
	if (board < ARRAY_SIZE(pc104) && line < ARRAY_SIZE(pc104_1))
		switch (pc104[board][line]) {
		case 422:
			info->flags |= ROCKET_MODE_RS422;
@@ -644,6 +645,8 @@ init_r_port(int board, int aiop, int chan, struct pci_dev *pci_dev)
			info->flags |= ROCKET_MODE_RS232;
			break;
		}
	else
		info->flags |= ROCKET_MODE_RS232;

	info->intmask = RXF_TRIG | TXFIFO_MT | SRC_INT | DELTA_CD | DELTA_CTS | DELTA_DSR;
	if (sInitChan(ctlp, &info->channel, aiop, chan) == 0) {
+3 −1
Original line number Diff line number Diff line
@@ -843,8 +843,10 @@ static int bcm_uart_probe(struct platform_device *pdev)
	if (IS_ERR(clk) && pdev->dev.of_node)
		clk = of_clk_get(pdev->dev.of_node, 0);

	if (IS_ERR(clk))
	if (IS_ERR(clk)) {
		clk_put(clk);
		return -ENODEV;
	}

	port->iotype = UPIO_MEM;
	port->irq = res_irq->start;
+7 −0
Original line number Diff line number Diff line
@@ -680,6 +680,12 @@ static int owl_uart_probe(struct platform_device *pdev)
		return PTR_ERR(owl_port->clk);
	}

	ret = clk_prepare_enable(owl_port->clk);
	if (ret) {
		dev_err(&pdev->dev, "could not enable clk\n");
		return ret;
	}

	owl_port->port.dev = &pdev->dev;
	owl_port->port.line = pdev->id;
	owl_port->port.type = PORT_OWL;
@@ -712,6 +718,7 @@ static int owl_uart_remove(struct platform_device *pdev)

	uart_remove_one_port(&owl_uart_driver, &owl_port->port);
	owl_uart_ports[pdev->id] = NULL;
	clk_disable_unprepare(owl_port->clk);

	return 0;
}
+10 −3
Original line number Diff line number Diff line
@@ -870,9 +870,16 @@ static void sci_receive_chars(struct uart_port *port)
				tty_insert_flip_char(tport, c, TTY_NORMAL);
		} else {
			for (i = 0; i < count; i++) {
				char c = serial_port_in(port, SCxRDR);
				char c;

				if (port->type == PORT_SCIF ||
				    port->type == PORT_HSCIF) {
					status = serial_port_in(port, SCxSR);
					c = serial_port_in(port, SCxRDR);
				} else {
					c = serial_port_in(port, SCxRDR);
					status = serial_port_in(port, SCxSR);
				}
				if (uart_handle_sysrq_char(port, c)) {
					count--; i--;
					continue;
Loading