Received: by 10.192.165.156 with SMTP id m28csp35036imm; Tue, 10 Apr 2018 15:51:17 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+6xO8tiJb7etxb95FTLBDQecQq0s7qPCTljyHUlxL77yErb3iVJDURYrcb7udbNybo5kcT X-Received: by 10.101.93.76 with SMTP id e12mr2568pgt.285.1523400677198; Tue, 10 Apr 2018 15:51:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523400677; cv=none; d=google.com; s=arc-20160816; b=hVzw9XFCGyLaQLeu/TgbxBZMTi7yzbc76BDbkwS+h0plp7bq6J8UM+lz4Se2rdral/ 0JCC5iCzLzgdBGtRnNBoQVp08i+OLpnKLO0UWyvRC52BLz8X6eKljqhinD7WfmfDClsu Ge+KCkfyxA2dfzVdeLUBw2qR5ZuUUyf05W4fsmFanJcT1W6uWWykd3CAfXLK2uGS6WXa 4G32O5wqcFboi5636JlmosNnVYNP2Z0vmJkmkGbIxdpiLC0jp3tm3fsH+EGUnCrejq8g 6QWsfzHrtjjw39n2COFzYG28v/8FaRY3/yB/C9XNz9r7Hb2aRceogzaF+C1qktJeuWB3 L+tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=jMu0LBP26Ga7Rrm7DaiVO1Byz6+M+Zo6e+D4f/HtIRk=; b=daBWTLGGDyoXbbt8pGXCTT3Qm2DpCsagnJOj0feLJ1Wd+61jjgGwu7wrt7ALPqLLtW om1QeQYamchhxC7/kRO5oHd+YD3r34rXZts53g5M/5EupFadLJzTINTEI8quFv2s4biQ 8BASNf9CX5zRycwbIH4Ls6thjnhrs/TYwtQb+wqLknnzlDj+QgpaMPOvKqs0tNAyC8bi g/1mArbkChvGBuyavQqep8Rc2PsulWSJ7EcGDmJ6/IbyzX1YPPBvzP7n8skVGrr3mrGP 9wE4qx6/bEitKybZTM3V6zwk1+l87nW3KqiBACi08lGaAngW5H2Kx/BlZuVmNB/YNTPT GFIQ== 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 r3si2418683pgf.125.2018.04.10.15.50.40; Tue, 10 Apr 2018 15:51:17 -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 S1756163AbeDJWqL (ORCPT + 99 others); Tue, 10 Apr 2018 18:46:11 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:45020 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932488AbeDJWi4 (ORCPT ); Tue, 10 Apr 2018 18:38:56 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 3716ED1B; Tue, 10 Apr 2018 22:38:56 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , "David S. Miller" Subject: [PATCH 4.14 117/138] net: fool proof dev_valid_name() Date: Wed, 11 Apr 2018 00:25:07 +0200 Message-Id: <20180410212915.786217964@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180410212902.121524696@linuxfoundation.org> References: <20180410212902.121524696@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Eric Dumazet [ Upstream commit a9d48205d0aedda021fc3728972a9e9934c2b9de ] We want to use dev_valid_name() to validate tunnel names, so better use strnlen(name, IFNAMSIZ) than strlen(name) to make sure to not upset KASAN. Signed-off-by: Eric Dumazet Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/core/dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/core/dev.c +++ b/net/core/dev.c @@ -1025,7 +1025,7 @@ bool dev_valid_name(const char *name) { if (*name == '\0') return false; - if (strlen(name) >= IFNAMSIZ) + if (strnlen(name, IFNAMSIZ) == IFNAMSIZ) return false; if (!strcmp(name, ".") || !strcmp(name, "..")) return false;