Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2971103imu; Sun, 9 Dec 2018 13:59:45 -0800 (PST) X-Google-Smtp-Source: AFSGD/UuvZzxdvnuX4iA4phrhUmapPvU5GwLQr2PDMdXDYQ3l30R6xkW2SJ1z/p2TntY7lPvmVI4 X-Received: by 2002:a62:47d9:: with SMTP id p86mr9804210pfi.95.1544392784990; Sun, 09 Dec 2018 13:59:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544392784; cv=none; d=google.com; s=arc-20160816; b=EFh7gmLMuWWymgnjbsHTq6rEYjoU+nHTbQCbujBPJDIRsK+EXJdlY/QZVZ6R9ASzzq 6BJ3qV1ZT4OM6Q1bJdq+iYq09gkt5GIXxTifWFSwjps6UD4zvi4kYoVJ+OtImj6DBOrU SJptGxAy7BoypT0jJmThuJuYgCWs9QIt9wZ+ImyyOPkRT+aSU4AwLgYu5AY910PNSn2a h59N41cM51xsxcUAw65lWLgeT1kuCIuOPIWtonfrAZu89cvCIWtkw3G+bvwBvMCFxO+w Gesr7OebkCKqwo2bNGQT+F2P342RLT46ehNG50FfqSA3FRBb3I3xNRd8kw8YE+ZPEuX+ CJng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=FUwoA8BuQYCuoclEQBWTAqt9kld1PFPDxs2M/hlzTgA=; b=yxuWTZ8lVU441jaC7tao7Q2K100j9J70lXBEwoP+6eqLf08IqAvMCm7ZoVin03pB8V tshhPwGh54tPY4T7DZ/5MUaL37hyKQ/lXiZDvNFRJU5r6EHVtxNpv0dgtyyNeNH0LYMq WAIAfbFyo2BahhJa+eFQLokQlGroN/mvoPFQEoZGXj/ih6Uwss4RZzEjYUnPsyVwkveb KU3VWZgu1J9NSGQcssdES44oAqL4jZPaqhyHfHlORsNDdq/D9BNzhSIzR/1Mh4dzlO1G ao38ehUteApDTw4tHP0mJPESGAQlnGC/TcReFYaKNW9M4X0Cn/shdGdyw70Spq95B38k 9IXg== ARC-Authentication-Results: i=1; mx.google.com; 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 p3si8268823plk.424.2018.12.09.13.59.29; Sun, 09 Dec 2018 13:59:44 -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; 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 S1726775AbeLIVzj (ORCPT + 99 others); Sun, 9 Dec 2018 16:55:39 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:35340 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726536AbeLIVzX (ORCPT ); Sun, 9 Dec 2018 16:55:23 -0500 Received: from pub.yeoldevic.com ([81.174.156.145] helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gW72n-0002ib-9y; Sun, 09 Dec 2018 21:55:21 +0000 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1gW72k-0003dy-Ck; Sun, 09 Dec 2018 21:55:18 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "syzbot" , "David S. Miller" , "Eric Dumazet" Date: Sun, 09 Dec 2018 21:50:33 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) X-Patchwork-Hint: ignore Subject: [PATCH 3.16 290/328] rtnl: limit IFLA_NUM_TX_QUEUES and IFLA_NUM_RX_QUEUES to 4096 In-Reply-To: X-SA-Exim-Connect-IP: 81.174.156.145 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.62-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Eric Dumazet commit 0e1d6eca5113858ed2caea61a5adc03c595f6096 upstream. 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 [bwh: Backported to 3.16: adjust context] Signed-off-by: Ben Hutchings --- net/core/rtnetlink.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -1831,6 +1831,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, ops->setup, num_tx_queues, num_rx_queues);