Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1388425 > unrolled thread

[PATCH 3.16 203/217] sh_eth: fix NULL pointer dereference in sh_eth_ring_format()

Started byBen Hutchings <ben@decadent.org.uk>
First post2016-04-27 02:20 +0200
Last post2016-04-27 02:20 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 3.16 203/217] sh_eth: fix NULL pointer dereference in   sh_eth_ring_format() Ben Hutchings <ben@decadent.org.uk> - 2016-04-27 02:20 +0200

#1388425 — [PATCH 3.16 203/217] sh_eth: fix NULL pointer dereference in sh_eth_ring_format()

FromBen Hutchings <ben@decadent.org.uk>
Date2016-04-27 02:20 +0200
Subject[PATCH 3.16 203/217] sh_eth: fix NULL pointer dereference in sh_eth_ring_format()
Message-ID<rslmV-92-5@gated-at.bofh.it>
3.16.35-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

[ Upstream commit c1b7fca65070bfadca94dd53a4e6b71cd4f69715 ]

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>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/net/ethernet/renesas/sh_eth.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -1162,7 +1162,8 @@ static void sh_eth_ring_format(struct ne
 	mdp->dirty_rx = (u32) (i - mdp->num_rx_ring);
 
 	/* Mark the last entry as wrapping the ring. */
-	rxdesc->status |= cpu_to_edmac(mdp, RD_RDEL);
+	if (rxdesc)
+		rxdesc->status |= cpu_to_edmac(mdp, RD_RDEL);
 
 	memset(mdp->tx_ring, 0, tx_ringsize);
 

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web