diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 7d25a762f4b382..8913283b08e953 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -2787,6 +2787,12 @@ struct net_device *rtnl_create_link(struct net *net, else if (ops->get_num_rx_queues) num_rx_queues = ops->get_num_rx_queues(); + if (num_tx_queues < 1 || num_tx_queues > 4096) + return ERR_PTR(-EINVAL); + + if (num_rx_queues < 1 || num_rx_queues > 4096) + return ERR_PTR(-EINVAL); + dev = alloc_netdev_mqs(ops->priv_size, ifname, name_assign_type, ops->setup, num_tx_queues, num_rx_queues); if (!dev)