]> git.baikalelectronics.ru Git - kernel.git/commit
nfp: avoid buffer leak when representor is missing
authorJakub Kicinski <jakub.kicinski@netronome.com>
Wed, 23 Aug 2017 06:22:44 +0000 (23:22 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 24 Aug 2017 03:39:44 +0000 (20:39 -0700)
commitb36f0713a066014afd3a4f4e22136e0d3082c923
treec85ad78817382c0ef0fb0c1a5ae38c9c4e71e808
parent876f913de8350d48fc918dccb7008745432325cc
nfp: avoid buffer leak when representor is missing

When driver receives a muxed frame, but it can't find the representor
netdev it is destined to it will try to "drop" that frame, i.e. reuse
the buffer.  The issue is that the replacement buffer has already been
allocated at this point, and reusing the buffer from received frame
will leak it.  Change the code to put the new buffer on the ring
earlier and not reuse the old buffer (make the buffer parameter
to nfp_net_rx_drop() a NULL).

Fixes: edb3080ced2d ("nfp: add support for tx/rx with metadata portid")
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/netronome/nfp/nfp_net_common.c