gianfar: simplify FCS handling and fix memory leak
authorAndy Spencer <aspencer@spacex.com>
Thu, 22 Feb 2018 19:05:33 +0000 (11:05 -0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 23 Feb 2018 17:26:36 +0000 (12:26 -0500)
commitd903ec77118c09f93a610b384d83a6df33a64fe6
tree37814077fb7396a5542f2c9b5efbac2297f72723
parentca79bec237f5809a7c3c59bd41cd0880aa889966
gianfar: simplify FCS handling and fix memory leak

Previously, buffer descriptors containing only the frame check sequence
(FCS) were skipped and not added to the skb. However, the page reference
count was still incremented, leading to a memory leak.

Fixing this inside gfar_add_rx_frag() is difficult due to reserved
memory handling and page reuse. Instead, move the FCS handling to
gfar_process_frame() and trim off the FCS before passing the skb up the
networking stack.

Signed-off-by: Andy Spencer <aspencer@spacex.com>
Signed-off-by: Jim Gruen <jgruen@spacex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/freescale/gianfar.c