Skip to content

Commit 0dd2a6f

Browse files
committed
Merge tag 'tty-6.4-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
Pull tty / serial fixes from Greg KH: "Here are some small tty and serial driver fixes for 6.4-rc3 to resolve some reported problems, and add some new device ids. These include: - termios documentation updates - vc_screen use-after-free fix - memory leak fix in arc_uart driver - new 8250 driver ids - other small serial driver fixes All of these have been in linux-next for a while with no reported problems" * tag 'tty-6.4-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: vc_screen: reload load of struct vc_data pointer in vcs_write() to avoid UAF serial: qcom-geni: fix enabling deactivated interrupt serial: 8250_bcm7271: fix leak in `brcmuart_probe` serial: 8250_bcm7271: balance clk_enable calls serial: arc_uart: fix of_iomap leak in `arc_serial_probe` serial: 8250: Document termios parameter of serial8250_em485_config() serial: Add support for Advantech PCI-1611U card serial: 8250_exar: Add support for USR298x PCI Modems
2 parents 2dd0d98 + 8fb9ea6 commit 0dd2a6f

File tree

7 files changed

+45
-12
lines changed

7 files changed

+45
-12
lines changed

drivers/tty/serial/8250/8250_bcm7271.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,7 +1012,7 @@ static int brcmuart_probe(struct platform_device *pdev)
10121012
of_property_read_u32(np, "clock-frequency", &clk_rate);
10131013

10141014
/* See if a Baud clock has been specified */
1015-
baud_mux_clk = of_clk_get_by_name(np, "sw_baud");
1015+
baud_mux_clk = devm_clk_get(dev, "sw_baud");
10161016
if (IS_ERR(baud_mux_clk)) {
10171017
if (PTR_ERR(baud_mux_clk) == -EPROBE_DEFER) {
10181018
ret = -EPROBE_DEFER;
@@ -1032,7 +1032,7 @@ static int brcmuart_probe(struct platform_device *pdev)
10321032
if (clk_rate == 0) {
10331033
dev_err(dev, "clock-frequency or clk not defined\n");
10341034
ret = -EINVAL;
1035-
goto release_dma;
1035+
goto err_clk_disable;
10361036
}
10371037

10381038
dev_dbg(dev, "DMA is %senabled\n", priv->dma_enabled ? "" : "not ");
@@ -1119,6 +1119,8 @@ static int brcmuart_probe(struct platform_device *pdev)
11191119
serial8250_unregister_port(priv->line);
11201120
err:
11211121
brcmuart_free_bufs(dev, priv);
1122+
err_clk_disable:
1123+
clk_disable_unprepare(baud_mux_clk);
11221124
release_dma:
11231125
if (priv->dma_enabled)
11241126
brcmuart_arbitration(priv, 0);
@@ -1133,6 +1135,7 @@ static int brcmuart_remove(struct platform_device *pdev)
11331135
hrtimer_cancel(&priv->hrt);
11341136
serial8250_unregister_port(priv->line);
11351137
brcmuart_free_bufs(&pdev->dev, priv);
1138+
clk_disable_unprepare(priv->baud_mux_clk);
11361139
if (priv->dma_enabled)
11371140
brcmuart_arbitration(priv, 0);
11381141
return 0;

drivers/tty/serial/8250/8250_exar.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,13 @@
4040
#define PCI_DEVICE_ID_COMMTECH_4224PCIE 0x0020
4141
#define PCI_DEVICE_ID_COMMTECH_4228PCIE 0x0021
4242
#define PCI_DEVICE_ID_COMMTECH_4222PCIE 0x0022
43+
4344
#define PCI_DEVICE_ID_EXAR_XR17V4358 0x4358
4445
#define PCI_DEVICE_ID_EXAR_XR17V8358 0x8358
4546

47+
#define PCI_SUBDEVICE_ID_USR_2980 0x0128
48+
#define PCI_SUBDEVICE_ID_USR_2981 0x0129
49+
4650
#define PCI_DEVICE_ID_SEALEVEL_710xC 0x1001
4751
#define PCI_DEVICE_ID_SEALEVEL_720xC 0x1002
4852
#define PCI_DEVICE_ID_SEALEVEL_740xC 0x1004
@@ -829,6 +833,15 @@ static const struct exar8250_board pbn_exar_XR17V8358 = {
829833
(kernel_ulong_t)&bd \
830834
}
831835

836+
#define USR_DEVICE(devid, sdevid, bd) { \
837+
PCI_DEVICE_SUB( \
838+
PCI_VENDOR_ID_USR, \
839+
PCI_DEVICE_ID_EXAR_##devid, \
840+
PCI_VENDOR_ID_EXAR, \
841+
PCI_SUBDEVICE_ID_USR_##sdevid), 0, 0, \
842+
(kernel_ulong_t)&bd \
843+
}
844+
832845
static const struct pci_device_id exar_pci_tbl[] = {
833846
EXAR_DEVICE(ACCESSIO, COM_2S, pbn_exar_XR17C15x),
834847
EXAR_DEVICE(ACCESSIO, COM_4S, pbn_exar_XR17C15x),
@@ -853,6 +866,10 @@ static const struct pci_device_id exar_pci_tbl[] = {
853866

854867
IBM_DEVICE(XR17C152, SATURN_SERIAL_ONE_PORT, pbn_exar_ibm_saturn),
855868

869+
/* USRobotics USR298x-OEM PCI Modems */
870+
USR_DEVICE(XR17C152, 2980, pbn_exar_XR17C15x),
871+
USR_DEVICE(XR17C152, 2981, pbn_exar_XR17C15x),
872+
856873
/* Exar Corp. XR17C15[248] Dual/Quad/Octal UART */
857874
EXAR_DEVICE(EXAR, XR17C152, pbn_exar_XR17C15x),
858875
EXAR_DEVICE(EXAR, XR17C154, pbn_exar_XR17C15x),

drivers/tty/serial/8250/8250_pci.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1920,6 +1920,8 @@ pci_moxa_setup(struct serial_private *priv,
19201920
#define PCI_SUBDEVICE_ID_SIIG_DUAL_30 0x2530
19211921
#define PCI_VENDOR_ID_ADVANTECH 0x13fe
19221922
#define PCI_DEVICE_ID_INTEL_CE4100_UART 0x2e66
1923+
#define PCI_DEVICE_ID_ADVANTECH_PCI1600 0x1600
1924+
#define PCI_DEVICE_ID_ADVANTECH_PCI1600_1611 0x1611
19231925
#define PCI_DEVICE_ID_ADVANTECH_PCI3620 0x3620
19241926
#define PCI_DEVICE_ID_ADVANTECH_PCI3618 0x3618
19251927
#define PCI_DEVICE_ID_ADVANTECH_PCIf618 0xf618
@@ -4085,6 +4087,9 @@ static SIMPLE_DEV_PM_OPS(pciserial_pm_ops, pciserial_suspend_one,
40854087
pciserial_resume_one);
40864088

40874089
static const struct pci_device_id serial_pci_tbl[] = {
4090+
{ PCI_VENDOR_ID_ADVANTECH, PCI_DEVICE_ID_ADVANTECH_PCI1600,
4091+
PCI_DEVICE_ID_ADVANTECH_PCI1600_1611, PCI_ANY_ID, 0, 0,
4092+
pbn_b0_4_921600 },
40884093
/* Advantech use PCI_DEVICE_ID_ADVANTECH_PCI3620 (0x3620) as 'PCI_SUBVENDOR_ID' */
40894094
{ PCI_VENDOR_ID_ADVANTECH, PCI_DEVICE_ID_ADVANTECH_PCI3620,
40904095
PCI_DEVICE_ID_ADVANTECH_PCI3620, 0x0001, 0, 0,

drivers/tty/serial/8250/8250_port.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -669,6 +669,7 @@ EXPORT_SYMBOL_GPL(serial8250_em485_supported);
669669
/**
670670
* serial8250_em485_config() - generic ->rs485_config() callback
671671
* @port: uart port
672+
* @termios: termios structure
672673
* @rs485: rs485 settings
673674
*
674675
* Generic callback usable by 8250 uart drivers to activate rs485 settings

drivers/tty/serial/arc_uart.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -606,10 +606,11 @@ static int arc_serial_probe(struct platform_device *pdev)
606606
}
607607
uart->baud = val;
608608

609-
port->membase = of_iomap(np, 0);
610-
if (!port->membase)
609+
port->membase = devm_platform_ioremap_resource(pdev, 0);
610+
if (IS_ERR(port->membase)) {
611611
/* No point of dev_err since UART itself is hosed here */
612-
return -ENXIO;
612+
return PTR_ERR(port->membase);
613+
}
613614

614615
port->irq = irq_of_parse_and_map(np, 0);
615616

drivers/tty/serial/qcom_geni_serial.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1664,19 +1664,18 @@ static int qcom_geni_serial_probe(struct platform_device *pdev)
16641664
uport->private_data = &port->private_data;
16651665
platform_set_drvdata(pdev, port);
16661666

1667-
ret = uart_add_one_port(drv, uport);
1668-
if (ret)
1669-
return ret;
1670-
16711667
irq_set_status_flags(uport->irq, IRQ_NOAUTOEN);
16721668
ret = devm_request_irq(uport->dev, uport->irq, qcom_geni_serial_isr,
16731669
IRQF_TRIGGER_HIGH, port->name, uport);
16741670
if (ret) {
16751671
dev_err(uport->dev, "Failed to get IRQ ret %d\n", ret);
1676-
uart_remove_one_port(drv, uport);
16771672
return ret;
16781673
}
16791674

1675+
ret = uart_add_one_port(drv, uport);
1676+
if (ret)
1677+
return ret;
1678+
16801679
/*
16811680
* Set pm_runtime status as ACTIVE so that wakeup_irq gets
16821681
* enabled/disabled from dev_pm_arm_wake_irq during system

drivers/tty/vt/vc_screen.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -656,10 +656,17 @@ vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
656656
}
657657
}
658658

659-
/* The vcs_size might have changed while we slept to grab
660-
* the user buffer, so recheck.
659+
/* The vc might have been freed or vcs_size might have changed
660+
* while we slept to grab the user buffer, so recheck.
661661
* Return data written up to now on failure.
662662
*/
663+
vc = vcs_vc(inode, &viewed);
664+
if (!vc) {
665+
if (written)
666+
break;
667+
ret = -ENXIO;
668+
goto unlock_out;
669+
}
663670
size = vcs_size(vc, attr, false);
664671
if (size < 0) {
665672
if (written)

0 commit comments

Comments
 (0)