]> git.baikalelectronics.ru Git - kernel.git/commit
net: mvneta: fix refilling for Rx DMA buffers
authorSimon Guinot <simon.guinot@sequanux.org>
Sun, 19 Jul 2015 11:00:53 +0000 (13:00 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 21 Jul 2015 07:30:02 +0000 (00:30 -0700)
commit059db4a9b2a122d97a0db33fc3fcb0948df0a51e
treec4b8116863b0ac7636537c3de5306ce6bd170716
parentf9991a64cbcff10f299d50c14fd2a48e87e5fbe0
net: mvneta: fix refilling for Rx DMA buffers

With the actual code, if a memory allocation error happens while
refilling a Rx descriptor, then the original Rx buffer is both passed
to the networking stack (in a SKB) and let in the Rx ring. This leads
to various kernel oops and crashes.

As a fix, this patch moves Rx descriptor refilling ahead of building
SKB with the associated Rx buffer. In case of a memory allocation
failure, data is dropped and the original DMA buffer is put back into
the Rx ring.

Signed-off-by: Simon Guinot <simon.guinot@sequanux.org>
Fixes: a2099e3eb275 ("net: mvneta: driver for Marvell Armada 370/XP network unit")
Cc: <stable@vger.kernel.org> # v3.8+
Tested-by: Yoann Sculo <yoann@sculo.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/marvell/mvneta.c