* [PATCH] tty: serial: pch_uart: add check for pci_get_slot()
@ 2026-06-23 14:05 Haoxiang Li
2026-06-23 16:03 ` Andy Shevchenko
0 siblings, 1 reply; 2+ messages in thread
From: Haoxiang Li @ 2026-06-23 14:05 UTC (permalink / raw)
To: gregkh, jirislaby, andriy.shevchenko, fourier.thomas, 2426767509, kees
Cc: linux-kernel, linux-serial, Haoxiang Li, stable
Add check for pci_get_slot() to prevent a potetial
null pointer dereference in pch_request_dma().
Fixes: 8368d6a2b739 ("pch_uart: don't hardcode PCI slot to get DMA device")
Cc: stable@vger.kernel.org
Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
---
drivers/tty/serial/pch_uart.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c
index ba1fcd663fe2..6c9e596a14e7 100644
--- a/drivers/tty/serial/pch_uart.c
+++ b/drivers/tty/serial/pch_uart.c
@@ -678,6 +678,11 @@ static void pch_request_dma(struct uart_port *port)
/* Get DMA's dev information */
dma_dev = pci_get_slot(priv->pdev->bus,
PCI_DEVFN(PCI_SLOT(priv->pdev->devfn), 0));
+ if (!dma_dev) {
+ dev_err(priv->port.dev, "%s: failed to get DMA device\n",
+ __func__);
+ return;
+ }
/* Set Tx DMA */
param = &priv->param_tx;
--
2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] tty: serial: pch_uart: add check for pci_get_slot()
2026-06-23 14:05 [PATCH] tty: serial: pch_uart: add check for pci_get_slot() Haoxiang Li
@ 2026-06-23 16:03 ` Andy Shevchenko
0 siblings, 0 replies; 2+ messages in thread
From: Andy Shevchenko @ 2026-06-23 16:03 UTC (permalink / raw)
To: Haoxiang Li
Cc: gregkh, jirislaby, fourier.thomas, 2426767509, kees,
linux-kernel, linux-serial, stable
On Tue, Jun 23, 2026 at 10:05:39PM +0800, Haoxiang Li wrote:
> Add check for pci_get_slot() to prevent a potetial
> null pointer dereference in pch_request_dma().
Not that it's quite possible, but probably you found this due to AI review
which might have considered some cases of manual binding a PCI device to any
PCI driver.
Given that is the case, I'm fine with the change.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-06-23 16:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-23 14:05 [PATCH] tty: serial: pch_uart: add check for pci_get_slot() Haoxiang Li
2026-06-23 16:03 ` Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®