Skip to contentSkip to conversation

Patch "sh_eth: fix NULL pointer dereference in sh_eth_ring_format()" has been added to the 4.5-stable tree

PATCH [email protected] 1 participant 1 message Apr 16, 2016

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

sh_eth: fix NULL pointer dereference in sh_eth_ring_format()

to the 4.5-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
sh_eth-fix-null-pointer-dereference-in-sh_eth_ring_format.patch
and it can be found in the queue-4.5 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From foo@baz Sat Apr 16 09:15:18 PDT 2016

From: Sergei Shtylyov <[email protected]>
Date: Tue, 8 Mar 2016 01:36:28 +0300
Subject: sh_eth: fix NULL pointer dereference in sh_eth_ring_format()

From: Sergei Shtylyov <[email protected]>

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

---
 drivers/net/ethernet/renesas/sh_eth.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/renesas/sh_eth.c +2 -1
@@ -1163,7 +1163,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_le32(RD_RDLE);
+	if (rxdesc)
+		rxdesc->status |= cpu_to_le32(RD_RDLE);
 
 	memset(mdp->tx_ring, 0, tx_ringsize);
 

Patches currently in stable-queue which might be from [email protected] are

queue-4.5/sh_eth-fix-null-pointer-dereference-in-sh_eth_ring_format.patch queue-4.5/sh_eth-advance-rxdesc-later-in-sh_eth_ring_format.patch