Message ID | 20240724170452.16837-2-dongli.zhang@oracle.com (mailing list archive) |
---|---|
State | Accepted |
Commit | ed7f2afdd0e043a397677e597ced0830b83ba0b3 |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | tap/tun: harden by dropping short frame | expand |
diff --git a/drivers/net/tap.c b/drivers/net/tap.c index bfdd3875fe86..77574f7a3bd4 100644 --- a/drivers/net/tap.c +++ b/drivers/net/tap.c @@ -1177,6 +1177,11 @@ static int tap_get_user_xdp(struct tap_queue *q, struct xdp_buff *xdp) struct sk_buff *skb; int err, depth; + if (unlikely(xdp->data_end - xdp->data < ETH_HLEN)) { + err = -EINVAL; + goto err; + } + if (q->flags & IFF_VNET_HDR) vnet_hdr_len = READ_ONCE(q->vnet_hdr_sz);