Skip to content

Commit

Permalink
net: enetc: handle the invalid XDP action the same way as XDP_DROP
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Vladimir Oltean authored and David S. Miller committed Apr 17, 2021
1 parent 7eab503 commit 975acc8
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions drivers/net/ethernet/freescale/enetc/enetc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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++;
Expand Down

0 comments on commit 975acc8

Please sign in to comment.