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] [day] [month] [year] [list]
Message-ID: <5537818d-054f-4765-ab70-ac7648fcb2ae@lunn.ch>
Date: Tue, 30 Dec 2025 12:14:16 +0100
From: Andrew Lunn <andrew@...n.ch>
To: Elad Nachman <enachman@...vell.com>
Cc: Alok Tiwari <alok.a.tiwari@...cle.com>,
	Vadym Kochan <vadym.kochan@...ision.eu>,
	"andrew+netdev@...n.ch" <andrew+netdev@...n.ch>,
	Taras Chornyi <taras.chornyi@...ision.eu>,
	"kuba@...nel.org" <kuba@...nel.org>,
	"davem@...emloft.net" <davem@...emloft.net>,
	"edumazet@...gle.com" <edumazet@...gle.com>,
	"pabeni@...hat.com" <pabeni@...hat.com>,
	"horms@...nel.org" <horms@...nel.org>,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	"alok.a.tiwarilinux@...il.com" <alok.a.tiwarilinux@...il.com>
Subject: Re: [EXTERNAL] [PATCH net] net: marvell: prestera: fix NULL
 dereference on devlink_alloc() failure

On Tue, Dec 30, 2025 at 10:12:23AM +0000, Elad Nachman wrote:
> > 
> 
> > 
> 
> >From: Alok Tiwari <alok.a.tiwari@...cle.com>
> >Sent: Tuesday, December 30, 2025 7:21 AM
> >To: Vadym Kochan <vadym.kochan@...ision.eu>; andrew+netdev@...n.ch; Taras
> Chornyi ><taras.chornyi@...ision.eu>; kuba@...nel.org; davem@...emloft.net;
> edumazet@...gle.com; >pabeni@...hat.com; horms@...nel.org;
> netdev@...r.kernel.org
> >Cc: alok.a.tiwarilinux@...il.com; alok.a.tiwari@...cle.com
> >Subject: [EXTERNAL] [PATCH net] net: marvell: prestera: fix NULL dereference
> on devlink_alloc() >failure
> 
> > 
> 
> >devlink_alloc() may return NULL on allocation failure, but 
> prestera_devlink_alloc() unconditionally >calls devlink_priv() on the returned
> pointer. This leads to a NULL pointer dereference if devlink >allocation fails.
> Add a check for a NULL devlink
> 
> >devlink_alloc() may return NULL on allocation failure, but
> 
> >prestera_devlink_alloc() unconditionally calls devlink_priv() on
> 
> >the returned pointer.
> 
> > 
> 
> >This leads to a NULL pointer dereference if devlink allocation fails.
> 
> >Add a check for a NULL devlink pointer and return NULL early to avoid
> 
> >the crash.
> 
>  
> 
> >Fixes: 34dd1710f5a3 ("net: marvell: prestera: Add basic devlink support")
> 
> >Signed-off-by: Alok Tiwari <alok.a.tiwari@...cle.com>
> 
> >---
> 
> > drivers/net/ethernet/marvell/prestera/prestera_devlink.c | 2 ++
> 
> > 1 file changed, 2 insertions(+)
> 
>  
> 
> >diff --git a/drivers/net/ethernet/marvell/prestera/prestera_devlink.c >b/
> drivers/net/ethernet/marvell/prestera/prestera_devlink.c
> 
> >index 2a4c9df4eb79..e63d95c1842f 100644
> 
> >--- a/drivers/net/ethernet/marvell/prestera/prestera_devlink.c
> 
> >+++ b/drivers/net/ethernet/marvell/prestera/prestera_devlink.c
> 
> >@@ -387,6 +387,8 @@ struct prestera_switch *prestera_devlink_alloc(struct 
> prestera_device >*dev)
> 
> >
> 
> >            dl = devlink_alloc(&prestera_dl_ops, sizeof(struct prestera_switch
> ),
> 
> >                                            dev->dev);
> 
> >+          if (!dl)
> 
> >+                        return NULL;
> 
> >
> 
> >            return devlink_priv(dl);
> 
> > }
> 
> >--
> 
> >2.50.1
> 
>  
> 
> Acked-by: Elad Nachman <enachman@...vell.com>

Hi Elad

Thanks for reviewing the patch, but please could you play with your
mail client quoting settings because it is making a mess of the email.

Thanks
	Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ