Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp5452513imm; Tue, 16 Oct 2018 10:26:04 -0700 (PDT) X-Google-Smtp-Source: ACcGV60PxnsOTdsttZNwUHzKcsco3s1tflJWofZkwG8aUTnQkF3NdfnilBRC15QdlMhOF1dw9FWu X-Received: by 2002:a63:cf0e:: with SMTP id j14-v6mr20985690pgg.195.1539710764675; Tue, 16 Oct 2018 10:26:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539710764; cv=none; d=google.com; s=arc-20160816; b=Ep/qQ3Y9Zf0RpDlnoymzdOKTRadtxMcMxWp3oylK7VriNafipDQzmWVjWIepzi8+fw a6YnL+lxvwXDHWWbWEvYs/nhDC3K1+UUkek4xWWw3uSbK+4kF9w84glamSoQn+CXl5y+ 8HrgYIQP9sguHS3SSWs6fxcsQTxnW6znKcy99AvfWcSDCMMKpVhj7YJNpAHFHC6DARrx O0Jx8iQdkIyGINyI95ARZ6J0P7uXxs4jQfiCRtl2lIcxexD7ko+f/PBbsUTHRnnNG7GA eXTsOtKty1OVp+/d+RS4pSaaD5NUfR6Q4+ZJPGyOvWQYh5RU2LA6818JGXqIA3evV5lB RCTw== 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=obmra3KSzKgor2LnzV1Y10vcDoEpqs6YPLFP2fMH5QU=; b=gjUk4hw16fh+ERt+HlEDa1B2Oe6xc+ihXgm+uBZ+I+9hDQ77cmtfVOwGEecfXgolOl vVh26UT9Z0RuwV8VMPNftGlQii4KGtm6+MPI2YLKBPA9lmeWm/HNMBAKpwiwcX7d8XqL lzrqRE3Ind/YHCC0whW5ZrM/s84LvTdDXHojK8dd6HqNdNVly/Wrf9a7Jjokjf872J/j c6ggIYorEC+ArZ1+gMdtQ8XT1ATpShOUw1xuKzmQMtzfKyTYQs6zSjy9kvOxvM8lUiap c0zwf6GAVWcEnRugSZkI+x9HwrE3w6II4lCMJBv5YabJtEqrKrtkdC1VzfExCtw72tTS YT8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GUmWeCrB; 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 r3-v6si14602592pga.321.2018.10.16.10.25.48; Tue, 16 Oct 2018 10:26:04 -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=GUmWeCrB; 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 S1731608AbeJQBPi (ORCPT + 99 others); Tue, 16 Oct 2018 21:15:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:34258 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730396AbeJQBPh (ORCPT ); Tue, 16 Oct 2018 21:15:37 -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 0DD1A20658; Tue, 16 Oct 2018 17:24:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539710651; bh=noOdfN5qsnPzzSqHUHAnb7nvaPK3MXGoTyFsX/rICSw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GUmWeCrBpoay45VU96RS6QSADHkE4QPZq/1UgK99VXA8ZcLXUU7g2yPDsQPRMRF5S Yvc7crPytn55EAnOVLjTeWZ4BLzRFl/KbiaZIieecHZT6hlm96oRXkEEDxP8+0UzE1 ikeFkYh0iI3VpiXwGVaHQLuIkkcB7xDqDhthI14Y= 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.9 40/71] rtnl: limit IFLA_NUM_TX_QUEUES and IFLA_NUM_RX_QUEUES to 4096 Date: Tue, 16 Oct 2018 19:09:37 +0200 Message-Id: <20181016170541.388868189@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181016170539.315587743@linuxfoundation.org> References: <20181016170539.315587743@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.9-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 @@ -2368,6 +2368,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);