Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp178896imd; Wed, 31 Oct 2018 16:54:57 -0700 (PDT) X-Google-Smtp-Source: AJdET5fJny+lJf83kK+0CBXwDn8SExDvl+VQhq3u9spc5C973O3y4ERS1Sjb4V/biO4l7K3wXkGr X-Received: by 2002:a17:902:16a4:: with SMTP id h33-v6mr5291491plh.141.1541030096960; Wed, 31 Oct 2018 16:54:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541030096; cv=none; d=google.com; s=arc-20160816; b=cviZ/U7yvtmIIBhONMj8ULIhEbPDIK++3RVTfH3JoGBvaQc1XdhFTx+sCK4JrNE7iZ D3uyWpM+KXBH0BOrw8Cjec8m7c14f2owSKOy+RcqCcHKKL6vO6ZSTEerZABRQHRmjUj4 VHOG/1h8jjTha0zCePdP4qLEENF7il3zUufTlQAukiWw8YYoG6SFFHxnGNg8qsZhyrr4 j9xxHeT583L8XDZTSkbTZhtQ3gCo+BE4BbpJQ/lChhtgeg5IeooRPz4FXJxU6AvgWPub rqlpxG5wFOaGCFbu+vGWVixW9tzlT8v43KuRdrAx2comLV0CwJI2u91e1VMKEXGnpBLQ H2bA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=Tj64p19DHWf43SUoLHPye0e3EvtMikmWznbVReNCYX0=; b=wpDnDk2iuUso0UwOMTwtqbcRCuVvganhwIjiKcQTHkiWRbVBJmOswYL8CFYSuMf1g6 Y6h1iCOQv7jjLqL4EjmZkiiO5r0/0iJqPIO45h8bguLG+23W0FmqxbvGIYgdgZmSAi6I hSjroJUM0Wc1MAkwRKrbxETYwkHvoIC8Fx077rCc0s4YtmFrDvzbGe1rsoqHhPH4rthz kOdik1z3409gnq72AXB2ZjWXsE0Khw6jA9+n8Tm7rNldEi1+8TLUaSBAb0tV9V5LH5fX ItODMYiZbpFZxf0UuGh/bsyoPyspDaA2FPrEFzONtokLETIwFOtvKxMN6JixPmXeYlVa NBAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="J3ir5gD/"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o11-v6si27668777pls.76.2018.10.31.16.54.42; Wed, 31 Oct 2018 16:54:56 -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="J3ir5gD/"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728030AbeKAIys (ORCPT + 99 others); Thu, 1 Nov 2018 04:54:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:52726 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726532AbeKAIGE (ORCPT ); Thu, 1 Nov 2018 04:06:04 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7D64A20866; Wed, 31 Oct 2018 23:05:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541027153; bh=rNjdU8QKxdta560gh0jiMdLoKJq5s/LlfVnklcD99xk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J3ir5gD/+sbxenb9joOnYlBxpHATNNLBWRlm0Ut1/UF6BZkU6Hn4j5gDBYacODGcp E/jiMT377cmDQ8XbLoxXurbzIgZbEiVf/oyPB+pTKBee6ruteQhwTg+kC7LITvlMyB SjyzqRe0Lpn04lbBY5wKcuhnQ4N7UUnQyWvZ34T4= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Serhey Popovych , "David S . Miller" , Sasha Levin Subject: [PATCH AUTOSEL 4.19 011/146] tun: Consistently configure generic netdev params via rtnetlink Date: Wed, 31 Oct 2018 19:03:26 -0400 Message-Id: <20181031230541.28822-11-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181031230541.28822-1-sashal@kernel.org> References: <20181031230541.28822-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Serhey Popovych [ Upstream commit df52eab23d703142c766ac00bdb8db19d71238d0 ] Configuring generic network device parameters on tun will fail in presence of IFLA_INFO_KIND attribute in IFLA_LINKINFO nested attribute since tun_validate() always return failure. This can be visualized with following ip-link(8) command sequences: # ip link set dev tun0 group 100 # ip link set dev tun0 group 100 type tun RTNETLINK answers: Invalid argument with contrast to dummy and veth drivers: # ip link set dev dummy0 group 100 # ip link set dev dummy0 type dummy # ip link set dev veth0 group 100 # ip link set dev veth0 group 100 type veth Fix by returning zero in tun_validate() when @data is NULL that is always in case since rtnl_link_ops->maxtype is zero in tun driver. Fixes: f019a7a594d9 ("tun: Implement ip link del tunXXX") Signed-off-by: Serhey Popovych Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/tun.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 50e9cc19023a..c52207beef88 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -2264,6 +2264,8 @@ static void tun_setup(struct net_device *dev) static int tun_validate(struct nlattr *tb[], struct nlattr *data[], struct netlink_ext_ack *extack) { + if (!data) + return 0; return -EINVAL; } -- 2.17.1