sh_eth: fix NULL pointer dereference in sh_eth_ring_format()
authorSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Mon, 7 Mar 2016 22:36:28 +0000 (01:36 +0300)
committerDavid S. Miller <davem@davemloft.net>
Thu, 10 Mar 2016 21:06:49 +0000 (16:06 -0500)
commitc1b7fca65070bfadca94dd53a4e6b71cd4f69715
tree7ff171853047b435e711ac14a69f8bd31167dec1
parentf720d0caa0af2c33ad15310974c7320345ab4468
sh_eth: fix NULL pointer dereference in sh_eth_ring_format()

In a low memory situation, if netdev_alloc_skb() fails on a first RX ring
loop iteration  in sh_eth_ring_format(), 'rxdesc' is still NULL.  Avoid
kernel oops by adding the 'rxdesc' check after the loop.

Reported-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/renesas/sh_eth.c