Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2514276imm; Thu, 7 Jun 2018 11:57:59 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIqpgEhnymNV2Tn62mC3j1Iq5/uW4cwn3Yhtmhi6+DIKGdpUoEvh8eZzqN8km/NgSyUqOr/ X-Received: by 2002:a62:3fdd:: with SMTP id z90-v6mr2851740pfj.216.1528397879917; Thu, 07 Jun 2018 11:57:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528397879; cv=none; d=google.com; s=arc-20160816; b=BykuJBz7p/W2pPKsOFB6PGjEWz/64z1jsW0LD1IXERwwT2u97NfLAt9Di/ezFu550e xU51Qqzgyyc3wQH/I5jC0paOQMnSer31+pVhfbrhuSoL5edP/cs6e41spCZ+8htuTze1 XCkDBXYbPvcioggsmLwrc/JOP8BG5ScMfDCVkrZOIQ/+IZz0Va4bUazdHLnhp8dEAnz/ VgdCTrFviFUW2//SrUGTPE7toYJWqwUDQlC3PtBRNkF9g3PFWm+GRgO/YgfX1/h36hf7 QkXZE0enXNJuZp6ikKhYoxaepjOlEICNrKmmIJiC3aZvof/K7YDcDm9AQiOU7nMD692T 9LeA== 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 :arc-authentication-results; bh=NV+tCSC/bb+Ebw3lAdzyfsk13EGNE91uUeuCfa8kJTI=; b=V3wuo2w7fF75erYveOL2Ex1dekAPkYNwvj4XtIGikyJqM+k9360Cl//RYFsSrVTJ1u 18TsAWld4d/ESJlenJTVWryuuP1jX/yGBgkYuGVEozV5j4cfmIHRsrSY16vZlOr0oxy5 xsyJM5CWh+gXTk9zN/luvgpGMaEVJ4tEo5pAjqEw3BxvDQ1Q1DHN0jX26evVPziuUIcb 1K38zm6M47FjoSLX0hBR38eDvVQHoJsV6OxKaUfyFmOPYT+RAzkyyQCwgL9l1tF7Qcg1 +WPxE++7Eo+Lk4ddtkC4nUmHNha36a/TIbQKdUlk08chJaP16/51u0gCz95EoiMhNDMC Pd+w== 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 f9-v6si2632151pgt.128.2018.06.07.11.57.45; Thu, 07 Jun 2018 11:57:59 -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; 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 S936114AbeFGQPh (ORCPT + 99 others); Thu, 7 Jun 2018 12:15:37 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:39112 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932894AbeFGOI6 (ORCPT ); Thu, 7 Jun 2018 10:08:58 -0400 Received: from [148.252.241.226] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1fQvay-0005Zl-FP; Thu, 07 Jun 2018 15:08:56 +0100 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1fQvaw-0002gB-WE; Thu, 07 Jun 2018 15:08:55 +0100 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, "Julien Gomes" , "Cong Wang" , "David S. Miller" Date: Thu, 07 Jun 2018 15:05:21 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 002/410] tun: allow positive return values on dev_get_valid_name() call In-Reply-To: X-SA-Exim-Connect-IP: 148.252.241.226 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.57-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Julien Gomes commit 5c25f65fd1e42685f7ccd80e0621829c105785d9 upstream. If the name argument of dev_get_valid_name() contains "%d", it will try to assign it a unit number in __dev__alloc_name() and return either the unit number (>= 0) or an error code (< 0). Considering positive values as error values prevent tun device creations relying this mechanism, therefor we should only consider negative values as errors here. Signed-off-by: Julien Gomes Acked-by: Cong Wang Signed-off-by: David S. Miller Signed-off-by: Ben Hutchings --- drivers/net/tun.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -1648,7 +1648,7 @@ static int tun_set_iff(struct net *net, if (!dev) return -ENOMEM; err = dev_get_valid_name(net, dev, name); - if (err) + if (err < 0) goto err_free_dev; dev_net_set(dev, net);