In the Linux kernel, the following vulnerability has been resolved:
net: tap: set skb->dev before parsing virtio net header in tapgetuser_xdp()
The commit 4f61f133f354 ("net: tap: NULL pointer derefence in devparseheaderprotocol when skb->dev is null") fixed a crash in tapgetuser() by assigning skb->dev before calling tunvnethdrtoskb(). This is required because virtionethdrtoskb() may invoke devparseheaderprotocol(), which dereferences skb->dev. Without the assignment, a NULL pointer dereference can occur.
However, tapgetuserxdp() still parses the virtio-net header before assigning skb->dev. When the vhost TX path passes an XDP buffer containing a GSO virtio-net header but the protocol is set to zero on purpose, tunvnethdrtoskb() can reach devparseheaderprotocol() while skb->dev is still NULL, resulting in a crash.
Fix this by looking up the tap device and assigning skb->dev before calling tunvnethdrtoskb(), matching the ordering already used in tapgetuser(). Preserve the existing RCU read-side critical section across devqueuexmit().