Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1984044imu; Fri, 14 Dec 2018 04:05:01 -0800 (PST) X-Google-Smtp-Source: AFSGD/Uid9vU5cKxsQP97ESwf3Eyi6TrhFQ80Fj72u7dvBb/LgKkJPzyKDe4RTNAbIIK27UVKVeG X-Received: by 2002:a63:d70e:: with SMTP id d14mr2465716pgg.159.1544789101483; Fri, 14 Dec 2018 04:05:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544789101; cv=none; d=google.com; s=arc-20160816; b=ofsjxgMEpx+Sj3h108IPtDVcPqtKYIOvAdl6QSFDPJAGWZSqLHNE3cjOpo7ELhdqee l2ZHAzF3dpl35VJ9gatTe45kE+2Hkhwv9nkaTdk5UBQOREFI0ulUohHNh/wgnijyNgj6 yitO2sbpI56EvwwMZeD6lvb4ozwTujqZNYo9sQpQlX3ssDkKoEeqhNLP6IjeCIAvreD5 QhZrNoh4xoHeckX24VK5mGT99Dj60N7FXa8/IGFCrY8EefXVnYvmfUbJ1QZbbvUnJF8W hVw0b4g86TXhbc5NL7xSLY+NeUKImWtLvKGPbqtDss6H0Y6ZTkws876tv0gGnDvIgXoq qw+w== 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=NaypgZ/e14XdGIPjAz5V5ef6NdAZ8t23ktN3RTk6gBg=; b=fV2jaEifzYlDsayNGLEPgeyV1VBgqaUCuRjjNtXok05JnG9Qy8AakPu5iQK+e31fy9 jRFKmP/WpoCy0+ayQaiLUW95PdfBNn4tY0DHqmcMbxvqB5LljnER5zqAxTzFgvJJlvJ7 rpmXQ1i7LAvnX3uE0Uhl0fc4tsexBg8aBRqkGZ41OO72GAH86nI/VjWCitudJ2BoPoN5 pYbyObqhMFkA+hz/IroGmSoLed2scOxUWjjSml4o60XefYPNcu9nC26BXWZxEs6ZruaN FPkczdM9xz9HtA5XDO2rTK6z7TmSL9ZMhVDdB3erp8naYn4BzHZ2IjKfR7VuoF1iQrnD gidw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="Kr/WnLf8"; 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 h3si3825401pll.116.2018.12.14.04.04.24; Fri, 14 Dec 2018 04:05:01 -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="Kr/WnLf8"; 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 S1729823AbeLNMBn (ORCPT + 99 others); Fri, 14 Dec 2018 07:01:43 -0500 Received: from mail.kernel.org ([198.145.29.99]:44200 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729805AbeLNMBj (ORCPT ); Fri, 14 Dec 2018 07:01:39 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (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 A1B0F2145D; Fri, 14 Dec 2018 12:01:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1544788899; bh=mIc0a0PQkCa701ELA9Qnad0ARPP1NFgWr3SvntwFJkk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Kr/WnLf8Ghb8FMFAaztfqJp4GvGGzWFU5EKR118CJluToLtZ/v1ANv0YI42D1WZnJ Ne2TT4dwYn8YNVaG/B40C8KdAmMh32gUmwxEbNQp4uxMUfW43T4bKwpu+YqqQjMd+C pl3yrnLNsfAkbggF09HqYfRrFhUsEDeL3uKg1Vmw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Eric W. Biederman" , Nicolas Dichtel , "David S. Miller" Subject: [PATCH 4.19 016/142] tun: forbid iface creation with rtnl ops Date: Fri, 14 Dec 2018 12:58:21 +0100 Message-Id: <20181214115747.699726508@linuxfoundation.org> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20181214115747.053633987@linuxfoundation.org> References: <20181214115747.053633987@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Nicolas Dichtel [ Upstream commit 35b827b6d06199841a83839e8bb69c0cd13a28be ] It's not supported right now (the goal of the initial patch was to support 'ip link del' only). Before the patch: $ ip link add foo type tun [ 239.632660] BUG: unable to handle kernel NULL pointer dereference at 0000000000000000 [snip] [ 239.636410] RIP: 0010:register_netdevice+0x8e/0x3a0 This panic occurs because dev->netdev_ops is not set by tun_setup(). But to have something usable, it will require more than just setting netdev_ops. Fixes: f019a7a594d9 ("tun: Implement ip link del tunXXX") CC: Eric W. Biederman Signed-off-by: Nicolas Dichtel Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/tun.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -2268,9 +2268,9 @@ static void tun_setup(struct net_device static int tun_validate(struct nlattr *tb[], struct nlattr *data[], struct netlink_ext_ack *extack) { - if (!data) - return 0; - return -EINVAL; + NL_SET_ERR_MSG(extack, + "tun/tap creation via rtnetlink is not supported."); + return -EOPNOTSUPP; } static size_t tun_get_size(const struct net_device *dev)