[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1489787644-28822-1-git-send-email-tremyfr@gmail.com>
Date: Fri, 17 Mar 2017 22:54:04 +0100
From: Philippe Reynes <tremyfr@...il.com>
To: davem@...emloft.net, mugunthanvnm@...com, jarod@...hat.com,
felipe.balbi@...ux.intel.com, edumazet@...gle.com, fw@...len.de
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
Philippe Reynes <tremyfr@...il.com>
Subject: [PATCH v3] net: sun: sungem: rix a possible null dereference
The function gem_begin_auto_negotiation dereference
the pointer ep before testing if it's null. This
patch add a check on ep before dereferencing it.
Fixes: 92552fdda557 ("net: sun: sungem: use new api
ethtool_{get|set}_link_ksettings")
Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
Signed-off-by: Philippe Reynes <tremyfr@...il.com>
---
Changelog:
v3:
- fix the sha1-id in the tag Fixes (thanks David Miller)
v2:
- use Fixes tag (thanks Sergei Shtylyov)
drivers/net/ethernet/sun/sungem.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/sun/sungem.c b/drivers/net/ethernet/sun/sungem.c
index dbfca04..fa607d0 100644
--- a/drivers/net/ethernet/sun/sungem.c
+++ b/drivers/net/ethernet/sun/sungem.c
@@ -1259,8 +1259,9 @@ static void gem_begin_auto_negotiation(struct gem *gp,
int duplex;
u32 advertising;
- ethtool_convert_link_mode_to_legacy_u32(&advertising,
- ep->link_modes.advertising);
+ if (ep)
+ ethtool_convert_link_mode_to_legacy_u32(
+ &advertising, ep->link_modes.advertising);
if (gp->phy_type != phy_mii_mdio0 &&
gp->phy_type != phy_mii_mdio1)
--
1.7.4.4
Powered by blists - more mailing lists