Skip to content

Commit

Permalink
net: sun: sungem: rix a possible null dereference
Browse files Browse the repository at this point in the history
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: 92552fd ("net: sun: sungem: use new api
ethtool_{get|set}_link_ksettings")

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Philippe Reynes authored and David S. Miller committed Mar 22, 2017
1 parent c5b71e6 commit e74bad6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/net/ethernet/sun/sungem.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e74bad6

Please sign in to comment.