From 7bd37cf4cf5122db89961faa20e3f1866cfdb452 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 7 Aug 2024 15:16:59 +0200 Subject: Merging upstream version 6.9.12. Signed-off-by: Daniel Baumann --- drivers/net/tap.c | 5 +++++ drivers/net/tun.c | 3 +++ 2 files changed, 8 insertions(+) (limited to 'drivers/net') diff --git a/drivers/net/tap.c b/drivers/net/tap.c index 9f0495e8df..feeeac715c 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); diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 92da8c03d9..f0f3fa1fc6 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -2451,6 +2451,9 @@ static int tun_xdp_one(struct tun_struct *tun, bool skb_xdp = false; struct page *page; + if (unlikely(datasize < ETH_HLEN)) + return -EINVAL; + xdp_prog = rcu_dereference(tun->xdp_prog); if (xdp_prog) { if (gso->gso_type) { -- cgit v1.2.3