Skip to content

Commit 799d2ff

Browse files
pldemonedavem330
authored andcommitted
sky2: Fix crash inside sky2_rx_clean
If sky2->tx_le = pci_alloc_consistent() or sky2->tx_ring = kcalloc() in sky2_alloc_buffers() fails, sky2->rx_ring = kcalloc() will never be called. In this error case handling, sky2_rx_clean() is called from within sky2_free_buffers(). In sky2_rx_clean() we find the following: ... memset(sky2->rx_le, 0, RX_LE_BYTES); ... This results in a memset using a NULL pointer and will crash the system. Signed-off-by: Mirko Lindner <[email protected]> Acked-by: Stephen Hemminger <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 92c7b0d commit 799d2ff

File tree

1 file changed

+3
-1
lines changed
  • drivers/net/ethernet/marvell

1 file changed

+3
-1
lines changed

drivers/net/ethernet/marvell/sky2.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1361,7 +1361,9 @@ static void sky2_rx_clean(struct sky2_port *sky2)
13611361
{
13621362
unsigned i;
13631363

1364-
memset(sky2->rx_le, 0, RX_LE_BYTES);
1364+
if (sky2->rx_le)
1365+
memset(sky2->rx_le, 0, RX_LE_BYTES);
1366+
13651367
for (i = 0; i < sky2->rx_pending; i++) {
13661368
struct rx_ring_info *re = sky2->rx_ring + i;
13671369

0 commit comments

Comments
 (0)