Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp5436864imm; Tue, 16 Oct 2018 10:12:13 -0700 (PDT) X-Google-Smtp-Source: ACcGV63xuYmAjpHfs1iL92s4995W24l18s7CtaqJoWkJd8LSfNxelMuL6SGJRGEnP5QYDePFZxQz X-Received: by 2002:a62:5982:: with SMTP id k2-v6mr22409107pfj.180.1539709933438; Tue, 16 Oct 2018 10:12:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539709933; cv=none; d=google.com; s=arc-20160816; b=PK58tMSvaUwtwlVWzvWG+Kc42fm+/v/LJkFyWYjnc8MHfkUd+ehN6vRUn+P6y0NHEy ecKOk30GnMyPgMVZ1HDGbJBYKyUtdioWCn5REyfum7iwuaGus4Y0lU1HLbFaX2hDKgWR 5DzdBrUa3dZjC/ZVy2C9zQQoKr/MlJkpqGmo34XfwQ6URD9MZcRFmA7tVDJH612mOzyK mUAjLNCac2NdPoJGPpMUn2C6b0wo3D/IMl4n7b7DzJIthBHqtcjJMqN9U4i41Qv4p93A AucjROf2E3uPbvKcQ2IwQdHjADxoJ8cF7LpTUk6BHyPY/XPeSrB/0fAcZuP1kGi0C3cy cAAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lYlChJ/WfYaKF4RW/ZfB4qzfY72GSJy1exYfQuiw39Y=; b=AcMChQmAyETW1RSiMqL9162naAND7YmPlZ+bglxuy1M9VQptB80P7O0IGeDONJWiFq uG4AyvnNIua/KoGcDQgDqr3ONnar47O0XDq0ff+W5sA8x6eVKKyiY53wxY+HLasuIOVk VDhdnOkHKNqFPrL/QP7/qGdOVKjkezfEuWJu+xSMEItQf5kVUdELG88QCpnRPCWdmZZn /ch1Fs6dXp7aRQ6M9PsfNQSAypAP35DbjA3slbrMHc8MWcbkplkBPttRDQC7yEGO6wHx PFiI+aQbB0HsNX6S8o1IMBT4tmM/rSggef07NVqOOVhkD+Qzn0JFFBb8ROmkwBcabMkK 13Uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Uyumduso; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c197-v6si15940604pfc.74.2018.10.16.10.11.57; Tue, 16 Oct 2018 10:12:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Uyumduso; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728014AbeJQBC0 (ORCPT + 99 others); Tue, 16 Oct 2018 21:02:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:43304 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727669AbeJQBC0 (ORCPT ); Tue, 16 Oct 2018 21:02:26 -0400 Received: from localhost (ip-213-127-77-176.ip.prioritytelecom.net [213.127.77.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8CA7E21476; Tue, 16 Oct 2018 17:11:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539709864; bh=mzjUolZDLrpTFOg1g8+Fe9ItwfbFSMJFPxArDao6H9E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UyumdusoUKjG7Y11OZBN6EppcZUK3MQDGiMWFCmJbCAJ+LjD351u19VnoAq8yf7PN 90NWNcO70TDwwjmWEimmwkl3SSzelk7OttXxrbAP2dCo32eyqlRyE9oMKWUTeG8CZb L7c0tbBO4dZyvzDcU09idr7RANEW09PS36iVUNuQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , syzbot , "David S. Miller" Subject: [PATCH 4.18 022/135] rtnl: limit IFLA_NUM_TX_QUEUES and IFLA_NUM_RX_QUEUES to 4096 Date: Tue, 16 Oct 2018 19:04:12 +0200 Message-Id: <20181016170516.778470765@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181016170515.447235311@linuxfoundation.org> References: <20181016170515.447235311@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Eric Dumazet [ Upstream commit 0e1d6eca5113858ed2caea61a5adc03c595f6096 ] We have an impressive number of syzkaller bugs that are linked to the fact that syzbot was able to create a networking device with millions of TX (or RX) queues. Let's limit the number of RX/TX queues to 4096, this really should cover all known cases. A separate patch will add various cond_resched() in the loops handling sysfs entries at device creation and dismantle. Tested: lpaa6:~# ip link add gre-4097 numtxqueues 4097 numrxqueues 4097 type ip6gretap RTNETLINK answers: Invalid argument lpaa6:~# time ip link add gre-4096 numtxqueues 4096 numrxqueues 4096 type ip6gretap real 0m0.180s user 0m0.000s sys 0m0.107s Fixes: 76ff5cc91935 ("rtnl: allow to specify number of rx and tx queues on device creation") Signed-off-by: Eric Dumazet Reported-by: syzbot Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/core/rtnetlink.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -2787,6 +2787,12 @@ struct net_device *rtnl_create_link(stru 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)