Skip to content

Commit 8c76e77

Browse files
wdebruijdavem330
authored andcommitted
tap: call skb_probe_transport_header after setting skb->dev
The BPF flow dissector expects either skb->sk or skb->dev set on all skbs. Delay flow dissection until after skb->dev is set. This requires calling from within an rcu read-side critical section. That is fine, see also the call from tun_xdp_one. Fixes: d0e13a1 ("flow_dissector: lookup netns by skb->sk if skb->dev is NULL") Reported-by: Christian Borntraeger <[email protected]> Signed-off-by: Willem de Bruijn <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent aff6db4 commit 8c76e77

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/net/tap.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,8 +1177,6 @@ static int tap_get_user_xdp(struct tap_queue *q, struct xdp_buff *xdp)
11771177
goto err_kfree;
11781178
}
11791179

1180-
skb_probe_transport_header(skb, ETH_HLEN);
1181-
11821180
/* Move network header to the right position for VLAN tagged packets */
11831181
if ((skb->protocol == htons(ETH_P_8021Q) ||
11841182
skb->protocol == htons(ETH_P_8021AD)) &&
@@ -1189,6 +1187,7 @@ static int tap_get_user_xdp(struct tap_queue *q, struct xdp_buff *xdp)
11891187
tap = rcu_dereference(q->tap);
11901188
if (tap) {
11911189
skb->dev = tap->dev;
1190+
skb_probe_transport_header(skb, ETH_HLEN);
11921191
dev_queue_xmit(skb);
11931192
} else {
11941193
kfree_skb(skb);

0 commit comments

Comments
 (0)