diff options
author | Vladimir Oltean <vladimir.oltean@nxp.com> | 2021-04-17 00:22:23 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-04-16 17:08:40 -0700 |
commit | 975acc833c9f34d784075815a8374760d1c6358b (patch) | |
tree | 38ca2540fee4423e3ec37996b02bef1c189f198d | |
parent | 7eab503b11ee1c4bb4a28866a6b029b0bbbeadfe (diff) |
net: enetc: handle the invalid XDP action the same way as XDP_DROP
When the XDP program returns an invalid action, we should free the RX
buffer.
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/freescale/enetc/enetc.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c index 56190d861bb9..0b84d4a74889 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.c +++ b/drivers/net/ethernet/freescale/enetc/enetc.c @@ -1282,6 +1282,9 @@ static int enetc_clean_rx_ring_xdp(struct enetc_bdr *rx_ring, xdp_act = bpf_prog_run_xdp(prog, &xdp_buff); switch (xdp_act) { + default: + bpf_warn_invalid_xdp_action(xdp_act); + fallthrough; case XDP_ABORTED: trace_xdp_exception(rx_ring->ndev, prog, xdp_act); fallthrough; @@ -1346,10 +1349,6 @@ static int enetc_clean_rx_ring_xdp(struct enetc_bdr *rx_ring, xdp_redirect_frm_cnt++; rx_ring->stats.xdp_redirect++; } - - break; - default: - bpf_warn_invalid_xdp_action(xdp_act); } rx_frm_cnt++; |