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>] [day] [month] [year] [list]
Message-ID: <20240904151514.8962-1-riyandhiman14@gmail.com>
Date: Wed,  4 Sep 2024 20:45:14 +0530
From: Riyan Dhiman <riyandhiman14@...il.com>
To: linux-kernel@...r.kernel.org
Cc: Riyan Dhiman <riyandhiman14@...il.com>
Subject: [PATCH] edd: Add null checks for edev and info in edd_get_pci_dev

Add null check for edev in the edd_get_pci_dev function
to prevent potential null pointer dereference. This check ensure
that the function safely handles cases where edev might be NULL,
avoiding possible crashes.

Signed-off-by: Riyan Dhiman <riyandhiman14@...il.com>
---
 drivers/firmware/edd.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/firmware/edd.c b/drivers/firmware/edd.c
index 55dec4eb2c00..6964e528bf35 100644
--- a/drivers/firmware/edd.c
+++ b/drivers/firmware/edd.c
@@ -648,7 +648,10 @@ edd_dev_is_type(struct edd_device *edev, const char *type)
 static struct pci_dev *
 edd_get_pci_dev(struct edd_device *edev)
 {
-	struct edd_info *info = edd_dev_get_info(edev);
+	struct edd_info *info;
+	if(!edev)
+		return NULL;
+	info = edd_dev_get_info(edev);
 
 	if (edd_dev_is_type(edev, "PCI") || edd_dev_is_type(edev, "XPRS")) {
 		return pci_get_domain_bus_and_slot(0,
-- 
2.46.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ