Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp60048imu; Thu, 8 Nov 2018 14:48:08 -0800 (PST) X-Google-Smtp-Source: AJdET5fhnkrFQsSCuEyYuRvOouZ9igmmCAnXaO3StUKAnG1b3j6sst6G8Dvho+BO4cM525PKCr/c X-Received: by 2002:a17:902:780f:: with SMTP id p15-v6mr6243846pll.197.1541717288854; Thu, 08 Nov 2018 14:48:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541717288; cv=none; d=google.com; s=arc-20160816; b=dwa0iCw3/Q/kcIpz77n/KOkJr/ZMwdewibSdZsSo/0oRS5bmU78H09Per7kdl/yDGh I9qcL6s/5Btiuk/9DRNtv7G2/nD4wCPqsrB4w5UHE00wW5YHdGq4yfUS30psv/1W1mPE wxhtcBXUz5y2uOg+JqYrc3hSbDXKrYRDUPb2XJzSqY/73vAekuWWAYDhXGsjlCFEYwnB WxUOhONewtQak6Cwzv54RjxVTjcP/I3pooXtCqaS1I7a0nF66We4iEL+qucPJ00Ulnxu uRqOEaR9hPxYdkebP+I+w5T3aX5h+KRU0vhclVE94x+E8MBvrUurut1owXJzhj57TC9/ I/UQ== 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=EjIxo3XWB05HpruRW6XYbutN6Lg2ezXxwzhjebe9IZw=; b=zdZg4vGs0tnv8zhPdmLlfj2FYUzU/5tRXZdvvEo5RkGJeQu3RqEqS31vAItTcaG4ZW BsB6aOyJwCsPDJ4sLuWQunwUWCkI1Rg46oLHOW+CFXVld7u01YwtAsL/nG9rZSEHfqMB 2Z7b8f0JcuFM4ukco/sDdvySfeavMWeLop8WEGwSg6RV10hJhGr5HcPr9SaYYrNYQf+t ghPETi1F0mlZJrmNrBbgYWy8BmjBctvDX7GXjnCkI2de8nHxputiH8U5g5CPx/B9OSx8 Zwimjzv99fQf5avrBMPjjQU2I7DUWKk2CSBXFuDccGol0etVVpnyYFviTTmpSFt6jQ0c 6DeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AL1LlYk+; 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 27si4673198pgp.135.2018.11.08.14.47.53; Thu, 08 Nov 2018 14:48:08 -0800 (PST) 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=AL1LlYk+; 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 S1728446AbeKIIYW (ORCPT + 99 others); Fri, 9 Nov 2018 03:24:22 -0500 Received: from mail.kernel.org ([198.145.29.99]:46380 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728033AbeKIHbl (ORCPT ); Fri, 9 Nov 2018 02:31:41 -0500 Received: from localhost (unknown [208.72.13.198]) (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 7D2282086C; Thu, 8 Nov 2018 21:54:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541714054; bh=Ngcx/CsOj6AEazkjItNQRlHGRK+PhiyMO3cy5g7PbgQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AL1LlYk+eG4bJZqaY6GJtGwmspXAW88mua+wr5FCSGb1NHxANMaQGgTIvneAyS1KF uGjuk9/zx3inIFJl7H3GJOtyZcWFkpdeaOsWdJgDFkM2R5wk/g9ynPyvwA3/U/EqpR dWaOjLt3b9A77j3qKsaosZHh13PjQuGyyr4F9iBQ= 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 3.18 015/144] rtnl: limit IFLA_NUM_TX_QUEUES and IFLA_NUM_RX_QUEUES to 4096 Date: Thu, 8 Nov 2018 13:49:46 -0800 Message-Id: <20181108215055.901615013@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181108215054.826084593@linuxfoundation.org> References: <20181108215054.826084593@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 3.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 @@ -1871,6 +1871,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);