]> git.baikalelectronics.ru Git - kernel.git/commit
net: bcmgenet: check harder for out of memory conditions
authorFlorian Fainelli <f.fainelli@gmail.com>
Mon, 8 Sep 2014 18:37:52 +0000 (11:37 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 8 Sep 2014 23:02:49 +0000 (16:02 -0700)
commitc4f130ecfc0679cfedfcfc9256f0a258b46a9308
tree28483cec84c56b551a51d19a25d5479ea948aae5
parent636d4ce7ddabc1e108a34c416a0f94047e9cf7a4
net: bcmgenet: check harder for out of memory conditions

There is a potential case where we might be failing to refill a
control block, leaving it with both a NULL skb pointer *and* a NULL
dma_unmap_addr.

The way we process incoming packets, by first calling
dma_unmap_single(), and then only checking for a potential NULL skb can
lead to situations where do pass a NULL dma_unmap_addr() to
dma_unmap_single(), resulting in an oops.

Fix this my moving the NULL skb check earlier, since no backing skb
also means no corresponding DMA mapping for this packet.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/genet/bcmgenet.c