netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: sun: sungem: rix a possible null dereference
@ 2017-03-14 21:23 Philippe Reynes
  2017-03-15 10:05 ` Sergei Shtylyov
  0 siblings, 1 reply; 3+ messages in thread
From: Philippe Reynes @ 2017-03-14 21:23 UTC (permalink / raw)
  To: davem, mugunthanvnm, jarod, felipe.balbi, edumazet, fw,
	dan.carpenter
  Cc: netdev, linux-kernel, Philippe Reynes

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.

This issue was added by the patch 92552fdd557:
"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>
---
 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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: sun: sungem: rix a possible null dereference
  2017-03-14 21:23 [PATCH] net: sun: sungem: rix a possible null dereference Philippe Reynes
@ 2017-03-15 10:05 ` Sergei Shtylyov
  2017-03-15 21:45   ` Philippe Reynes
  0 siblings, 1 reply; 3+ messages in thread
From: Sergei Shtylyov @ 2017-03-15 10:05 UTC (permalink / raw)
  To: Philippe Reynes, davem, mugunthanvnm, jarod, felipe.balbi,
	edumazet, fw, dan.carpenter
  Cc: netdev, linux-kernel

Hello!

On 3/15/2017 12:23 AM, Philippe Reynes wrote:

> 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.
>
> This issue was added by the patch 92552fdd557:
> "net: sun: sungem: use new api ethtool_{get|set}_link_ksettings".

    There's Fixes: tag for that now, described in 
Documentation/process/submitting-patches.rst...

> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
[...]

MBR, Sergei

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: sun: sungem: rix a possible null dereference
  2017-03-15 10:05 ` Sergei Shtylyov
@ 2017-03-15 21:45   ` Philippe Reynes
  0 siblings, 0 replies; 3+ messages in thread
From: Philippe Reynes @ 2017-03-15 21:45 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: davem, mugunthanvnm, jarod, felipe.balbi, edumazet, fw,
	dan.carpenter, netdev, linux-kernel

Hi Sergei,

On 3/15/17, Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> wrote:
> Hello!
>
> On 3/15/2017 12:23 AM, Philippe Reynes wrote:
>
>> 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.
>>
>> This issue was added by the patch 92552fdd557:
>> "net: sun: sungem: use new api ethtool_{get|set}_link_ksettings".
>
>     There's Fixes: tag for that now, described in
> Documentation/process/submitting-patches.rst...

Thanks a lot for pointing me this tag.
I'm sending a v2 of this patch with this tag.

>> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
>> Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
> [...]
>
> MBR, Sergei
>

Thanks,
Philippe

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-03-15 21:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-14 21:23 [PATCH] net: sun: sungem: rix a possible null dereference Philippe Reynes
2017-03-15 10:05 ` Sergei Shtylyov
2017-03-15 21:45   ` Philippe Reynes

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).