summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/intel/idpf/virtchnl2.h
diff options
context:
space:
mode:
authorAlexander Lobakin <aleksander.lobakin@intel.com>2023-12-11 15:31:44 +0300
committerTony Nguyen <anthony.l.nguyen@intel.com>2023-12-26 20:04:53 +0300
commitfea7b71b8751a0bfa7fdf9977e5782f061f71589 (patch)
tree61963eb3804f561eded7bc7d08a604a33d27ca66 /drivers/net/ethernet/intel/idpf/virtchnl2.h
parentdff90e4a092b771354287fbe55e557467c9da620 (diff)
downloadlinux-fea7b71b8751a0bfa7fdf9977e5782f061f71589.tar.xz
idpf: fix corrupted frames and skb leaks in singleq mode
idpf_ring::skb serves only for keeping an incomplete frame between several NAPI Rx polling cycles, as one cycle may end up before processing the end of packet descriptor. The pointer is taken from the ring onto the stack before entering the loop and gets written there after the loop exits. When inside the loop, only the onstack pointer is used. For some reason, the logics is broken in the singleq mode, where the pointer is taken from the ring each iteration. This means that if a frame got fragmented into several descriptors, each fragment will have its own skb, but only the last one will be passed up the stack (containing garbage), leaving the rest leaked. Then, on ifdown, rxq::skb is being freed only in the splitq mode, while it can point to a valid skb in singleq as well. This can lead to a yet another skb leak. Just don't touch the ring skb field inside the polling loop, letting the onstack skb pointer work as expected: build a new skb if it's the first frame descriptor and attach a frag otherwise. On ifdown, free rxq::skb unconditionally if the pointer is non-NULL. Fixes: a5ab9ee0df0b ("idpf: add singleq start_xmit and napi poll") Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com> Reviewed-by: Michal Kubiak <michal.kubiak@intel.com> Reviewed-by: Simon Horman <horms@kernel.org> Reviewed-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com> Tested-by: Scott Register <scott.register@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel/idpf/virtchnl2.h')
0 files changed, 0 insertions, 0 deletions