mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 10:31:46 +09:00
net: thunderx: don't allow jumbo frames with XDP
[ Upstream commit1f227d1608] The thunderx driver forbids to load an eBPF program if the MTU is too high, but this can be circumvented by loading the eBPF, then raising the MTU. Fix this by limiting the MTU if an eBPF program is already loaded. Fixes:05c773f52b("net: thunderx: Add basic XDP support") Signed-off-by: Matteo Croce <mcroce@redhat.com> Acked-by: Jesper Dangaard Brouer <brouer@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
6d5d30e033
commit
4a692bc1d5
@@ -1461,6 +1461,15 @@ static int nicvf_change_mtu(struct net_device *netdev, int new_mtu)
|
||||
struct nicvf *nic = netdev_priv(netdev);
|
||||
int orig_mtu = netdev->mtu;
|
||||
|
||||
/* For now just support only the usual MTU sized frames,
|
||||
* plus some headroom for VLAN, QinQ.
|
||||
*/
|
||||
if (nic->xdp_prog && new_mtu > MAX_XDP_MTU) {
|
||||
netdev_warn(netdev, "Jumbo frames not yet supported with XDP, current MTU %d.\n",
|
||||
netdev->mtu);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
netdev->mtu = new_mtu;
|
||||
|
||||
if (!netif_running(netdev))
|
||||
|
||||
Reference in New Issue
Block a user