net/mlx5e: Fix use-after-free after xdp_return_frame
authorMaxim Mikityanskiy <maximmi@mellanox.com>
Fri, 15 Mar 2019 14:41:43 +0000 (16:41 +0200)
committerSaeed Mahameed <saeedm@mellanox.com>
Fri, 19 Apr 2019 20:55:36 +0000 (13:55 -0700)
commit12fc512f5741443a03adde2ead20724da8ad550a
tree3adab073f555fe66f509a876fd5866ff731bcc98
parent36ad7022536e0c65f8baeeaa5efde11dec44808a
net/mlx5e: Fix use-after-free after xdp_return_frame

xdp_return_frame releases the frame. It leads to releasing the page, so
it's not allowed to access xdpi.xdpf->len after that, because xdpi.xdpf
is at xdp->data_hard_start after convert_to_xdp_frame. This patch moves
the memory access to precede the return of the frame.

Fixes: 58b99ee3e3ebe ("net/mlx5e: Add support for XDP_REDIRECT in device-out side")
Signed-off-by: Maxim Mikityanskiy <maximmi@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c