Skip to content

Commit 3a1e2f4

Browse files
borkmanndavem330
authored andcommitted
net: Make consumed action consistent in sch_handle_egress
While looking at TC_ACT_* handling, the TC_ACT_CONSUMED is only handled in sch_handle_ingress but not sch_handle_egress. This was added via cd11b16 ("net/tc: introduce TC_ACT_REINSERT.") and e5cf1ba ("act_mirred: use TC_ACT_REINSERT when possible") and later got renamed into TC_ACT_CONSUMED via 720f22f ("net: sched: refactor reinsert action"). The initial work was targeted for ovs back then and only needed on ingress, and the mirred action module also restricts it to only that. However, given it's an API contract it would still make sense to make this consistent to sch_handle_ingress and handle it on egress side in the same way, that is, setting return code to "success" and returning NULL back to the caller as otherwise an action module sitting on egress returning TC_ACT_CONSUMED could lead to an UAF when untreated. Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Reviewed-by: Simon Horman <horms@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 28d18b6 commit 3a1e2f4

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

net/core/dev.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4062,6 +4062,8 @@ sch_handle_egress(struct sk_buff *skb, int *ret, struct net_device *dev)
40624062
case TC_ACT_QUEUED:
40634063
case TC_ACT_TRAP:
40644064
consume_skb(skb);
4065+
fallthrough;
4066+
case TC_ACT_CONSUMED:
40654067
*ret = NET_XMIT_SUCCESS;
40664068
return NULL;
40674069
}

0 commit comments

Comments
 (0)