lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230614153226.117768-1-cymi20@fudan.edu.cn>
Date:   Wed, 14 Jun 2023 08:32:26 -0700
From:   Chenyuan Mi <cymi20@...an.edu.cn>
To:     ilpo.jarvinen@...ux.intel.com
Cc:     andriy.shevchenko@...ux.intel.com, gregkh@...uxfoundation.org,
        jirislaby@...nel.org, linux-serial@...r.kernel.org,
        linux-kernel@...r.kernel.org, Chenyuan Mi <cymi20@...an.edu.cn>
Subject: [PATCH] serial: 8250_lpss: Fix missing check for return value of pci_get_slot()

The pci_get_slot() function may return NULL, which may
cause null pointer deference, and most other callsites of
pci_get_slot() do Null check. Add Null check for return
value of pci_get_slot().

Found by our static analysis tool.

Signed-off-by: Chenyuan Mi <cymi20@...an.edu.cn>
---
 drivers/tty/serial/8250/8250_lpss.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/tty/serial/8250/8250_lpss.c b/drivers/tty/serial/8250/8250_lpss.c
index 0e43bdfb7459..05af5865ee1b 100644
--- a/drivers/tty/serial/8250/8250_lpss.c
+++ b/drivers/tty/serial/8250/8250_lpss.c
@@ -137,6 +137,8 @@ static int byt_serial_setup(struct lpss8250 *lpss, struct uart_port *port)
 	}
 
 	dma_dev = pci_get_slot(pdev->bus, PCI_DEVFN(PCI_SLOT(pdev->devfn), 0));
+	if (!dma_dev)
+		return -ENODEV;
 
 	param->dma_dev = &dma_dev->dev;
 	param->m_master = 0;
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ