* [PATCH][next] dpaa2-mac: Fix potential null pointer dereference
@ 2020-09-25 17:03 Gustavo A. R. Silva
2020-09-26 0:15 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Gustavo A. R. Silva @ 2020-09-25 17:03 UTC (permalink / raw)
To: Ioana Ciornei, Ioana Radulescu, David S. Miller, Jakub Kicinski,
Andrew Lunn
Cc: netdev, linux-kernel, Gustavo A. R. Silva
There is a null-check for _pcs_, but it is being dereferenced
prior to this null-check. So, if _pcs_ can actually be null,
then there is a potential null pointer dereference that should
be fixed by null-checking _pcs_ before being dereferenced.
Addresses-Coverity-ID: 1497159 ("Dereference before null check")
Fixes: 94ae899b2096 ("dpaa2-mac: add PCS support through the Lynx module")
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
---
drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
index 6ff64dd1cf27..283c5b1dbaad 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
@@ -291,9 +291,9 @@ static int dpaa2_pcs_create(struct dpaa2_mac *mac,
static void dpaa2_pcs_destroy(struct dpaa2_mac *mac)
{
struct lynx_pcs *pcs = mac->pcs;
- struct device *dev = &pcs->mdio->dev;
if (pcs) {
+ struct device *dev = &pcs->mdio->dev;
lynx_pcs_destroy(pcs);
put_device(dev);
mac->pcs = NULL;
--
2.27.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH][next] dpaa2-mac: Fix potential null pointer dereference
2020-09-25 17:03 [PATCH][next] dpaa2-mac: Fix potential null pointer dereference Gustavo A. R. Silva
@ 2020-09-26 0:15 ` David Miller
2020-09-29 13:14 ` Gustavo A. R. Silva
0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2020-09-26 0:15 UTC (permalink / raw)
To: gustavoars
Cc: ioana.ciornei, ruxandra.radulescu, kuba, andrew, netdev, linux-kernel
From: "Gustavo A. R. Silva" <gustavoars@kernel.org>
Date: Fri, 25 Sep 2020 12:03:23 -0500
> There is a null-check for _pcs_, but it is being dereferenced
> prior to this null-check. So, if _pcs_ can actually be null,
> then there is a potential null pointer dereference that should
> be fixed by null-checking _pcs_ before being dereferenced.
>
> Addresses-Coverity-ID: 1497159 ("Dereference before null check")
> Fixes: 94ae899b2096 ("dpaa2-mac: add PCS support through the Lynx module")
> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH][next] dpaa2-mac: Fix potential null pointer dereference
2020-09-26 0:15 ` David Miller
@ 2020-09-29 13:14 ` Gustavo A. R. Silva
0 siblings, 0 replies; 3+ messages in thread
From: Gustavo A. R. Silva @ 2020-09-29 13:14 UTC (permalink / raw)
To: David Miller
Cc: ioana.ciornei, ruxandra.radulescu, kuba, andrew, netdev, linux-kernel
On Fri, Sep 25, 2020 at 05:15:54PM -0700, David Miller wrote:
> From: "Gustavo A. R. Silva" <gustavoars@kernel.org>
> Date: Fri, 25 Sep 2020 12:03:23 -0500
>
> > There is a null-check for _pcs_, but it is being dereferenced
> > prior to this null-check. So, if _pcs_ can actually be null,
> > then there is a potential null pointer dereference that should
> > be fixed by null-checking _pcs_ before being dereferenced.
> >
> > Addresses-Coverity-ID: 1497159 ("Dereference before null check")
> > Fixes: 94ae899b2096 ("dpaa2-mac: add PCS support through the Lynx module")
> > Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
>
> Applied, thanks.
Thanks, Dave.
--
Gustavo
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-09-29 13:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-25 17:03 [PATCH][next] dpaa2-mac: Fix potential null pointer dereference Gustavo A. R. Silva
2020-09-26 0:15 ` David Miller
2020-09-29 13:14 ` Gustavo A. R. Silva
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).