Message ID | 20230804141651.746654-2-cascardo@canonical.com |
---|---|
State | New |
Headers | show |
Series | [SRU,OEM-5.17,1/1] net: tun: fix bugs for oversize packet when napi frags enabled | expand |
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index aa78d7e00289..ca3336246638 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -1431,7 +1431,8 @@ static struct sk_buff *tun_napi_alloc_frags(struct tun_file *tfile, int err; int i; - if (it->nr_segs > MAX_SKB_FRAGS + 1) + if (it->nr_segs > MAX_SKB_FRAGS + 1 || + len > (ETH_MAX_MTU - NET_SKB_PAD - NET_IP_ALIGN)) return ERR_PTR(-EMSGSIZE); local_bh_disable();