Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2233852imm; Thu, 18 Oct 2018 11:07:30 -0700 (PDT) X-Google-Smtp-Source: ACcGV63UfSTGUmLFhVBK0jOA4+BOAEjllwUHgLY+puvMRrbNz5AOqdXRu6qYy9xeW22444moj75z X-Received: by 2002:a63:b518:: with SMTP id y24-v6mr29664518pge.436.1539886050762; Thu, 18 Oct 2018 11:07:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539886050; cv=none; d=google.com; s=arc-20160816; b=f2pOs6RV4WvB0nF+nrHqpbAzMFohSrgER5gf6lvI/uETeKJIBidpOhIhz89lFs6OZx so/bARjFzvS2DAoXHVAdTtgTZgdc7CdRpH+o6BGfbtz5kZoMaWPHMKmkg+ipU42TGD7h UHoGn1sXmRG2MWdMHiAQrLyg95De2i4HckCzR/1gobnGfPYJUUOeO8/VIQWWHwbwxmnc xm/hf2+M9jIAipvAGIkWse6f4XOk/ytsXovw0h0QH06GzwJcRo1zXB5tlvsmuCrJk1xl HInDdWdNOu5TmdvbMrb3Yze70vy/ezfq/FKKu05wMacT/dGE+4tfxX4EYx30kU9ddwoa t2qQ== 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=UUzbrIhcycJn4xZNx5aoW/ivFgXIfE/3hMX3ZVt+Jtk=; b=vU2J01Jm30kbrF3kdW+A62JcdvoDeA57/Wn3jnt+P5j5RsTaFEsABEjOuhKABhrVCN YI/bs3shgbsgq3Y3slYGCmOHEbfmW6v+FIDbr5FjW1TfzBnsPQi2qDvVsje0/KqlxISQ PTcAMfYXXwTS5RrSFN0W2TCT2LambVSBQpj4gw4tEyu6n59mMs6Up/snnR+MVSEMpKkU mzuG5C6PPEn5xzwJIJmqS+iHAcIwG56z3BhiLcqxGXe6aUWxRZMRzzAn97YNRcMMVQTY qK3U6EhRHRcZwRwvslKh+vzzbX8frW9ndye4WpRsjVZ2vSV4M8yZ1jdMwIigEvCPjwJn BJmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qESYb8+P; 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 n15-v6si22145170pgc.143.2018.10.18.11.07.15; Thu, 18 Oct 2018 11:07:30 -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=qESYb8+P; 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 S1730414AbeJSCIQ (ORCPT + 99 others); Thu, 18 Oct 2018 22:08:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:57158 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729977AbeJSCIP (ORCPT ); Thu, 18 Oct 2018 22:08:15 -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 77FA220658; Thu, 18 Oct 2018 18:06:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539885968; bh=Gnps1+kPXzLfisvtJJdGmB0gbfrLsF4J4bCUYNLLs2g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qESYb8+PT4MQiM6t+vLPsavW/ZEvUludhvgLQs4Ue/QSZT5++FqSNZztswCiwbdUN ng6pTbI32fTNGwnZbkXw9L7l4b3F7sPjJagVPgtq97zCpH4gKG/ZSoXkbh82KaZGem CDf7tiY+iAKo9H64c6oh9d4zm7lZeB+uzBEIWUuI= 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.4 30/48] rtnl: limit IFLA_NUM_TX_QUEUES and IFLA_NUM_RX_QUEUES to 4096 Date: Thu, 18 Oct 2018 19:55:05 +0200 Message-Id: <20181018175429.575034056@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181018175427.133690306@linuxfoundation.org> References: <20181018175427.133690306@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.4-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 @@ -2116,6 +2116,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); + err = -ENOMEM; dev = alloc_netdev_mqs(ops->priv_size, ifname, name_assign_type, ops->setup, num_tx_queues, num_rx_queues);