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-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241028-ncsi-fixes-v1-1-f0bcfaf6eb88@codeconstruct.com.au>
Date: Mon, 28 Oct 2024 13:06:56 +0800
From: Jeremy Kerr <jk@...econstruct.com.au>
To: Samuel Mendoza-Jonas <sam@...dozajonas.com>, 
 "David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, 
 Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, 
 Simon Horman <horms@...nel.org>, Vijay Khemka <vijaykhemka@...com>
Cc: netdev@...r.kernel.org
Subject: [PATCH 1/2] net: ncsi: don't assume associated netdev has a
 platform_device parent

The ncsi driver currently does a:

       pdev = to_platform_device(dev->dev.parent);
       if (pdev) {

However, dev->dev.parent may be null, and to_platform_device() will not
catch this case as intended by the conditional.

Instead, check that dev->dev.parent is present, and is a
platform_device, before converting.

Fixes: 5e0fcc16e5c5 ("net/ncsi: Support for multi host mellanox card")
Signed-off-by: Jeremy Kerr <jk@...econstruct.com.au>
---
 net/ncsi/ncsi-manage.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ncsi/ncsi-manage.c b/net/ncsi/ncsi-manage.c
index 5cf55bde366d1813865ac5da17d232b5eadb2a3e..647d12fde693114cfe3970e75546df48ad4c335e 100644
--- a/net/ncsi/ncsi-manage.c
+++ b/net/ncsi/ncsi-manage.c
@@ -1789,8 +1789,8 @@ struct ncsi_dev *ncsi_register_dev(struct net_device *dev,
 	ndp->ptype.dev = dev;
 	dev_add_pack(&ndp->ptype);
 
-	pdev = to_platform_device(dev->dev.parent);
-	if (pdev) {
+	if (dev->dev.parent && dev_is_platform(dev->dev.parent)) {
+		pdev = to_platform_device(dev->dev.parent);
 		np = pdev->dev.of_node;
 		if (np && (of_property_read_bool(np, "mellanox,multi-host") ||
 			   of_property_read_bool(np, "mlx,multi-host")))

-- 
2.39.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ