sfc: Fix memory leak when discarding scattered packets
authorBen Hutchings <bhutchings@solarflare.com>
Thu, 4 Jul 2013 22:48:46 +0000 (23:48 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 28 Jul 2013 23:29:53 +0000 (16:29 -0700)
commit1c6d3d1d21e522c9722cd6bdfd57afb171786028
treebd6e918aa0918f5f3d24c1da24b5791396052035
parentc3a5491228f90fd82e67b7ccd2fcbaf984d44c07
sfc: Fix memory leak when discarding scattered packets

[ Upstream commit 734d4e159b283a4ae4d007b7e7a91d84398ccb92 ]

Commit 2768935a4660 ('sfc: reuse pages to avoid DMA mapping/unmapping
costs') did not fully take account of DMA scattering which was
introduced immediately before.  If a received packet is invalid and
must be discarded, we only drop a reference to the first buffer's
page, but we need to drop a reference for each buffer the packet
used.

I think this bug was missed partly because efx_recycle_rx_buffers()
was not renamed and so no longer does what its name says.  It does not
change the state of buffers, but only prepares the underlying pages
for recycling.  Rename it accordingly.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/sfc/rx.c