Received: by 10.192.165.156 with SMTP id m28csp58057imm; Tue, 10 Apr 2018 16:20:18 -0700 (PDT) X-Google-Smtp-Source: AIpwx48N9QTYS05QgW2TfWaf9hYamHuMvzMAVPvDiHlqYLtXfy5NFOMIW2RZJMMzIZmgUcqWfxC9 X-Received: by 10.101.70.8 with SMTP id v8mr1654460pgq.336.1523402417936; Tue, 10 Apr 2018 16:20:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523402417; cv=none; d=google.com; s=arc-20160816; b=HPIXV4AvZY4X4pBoMTIsxnih9j/+9a6rqXXaWajNSenh5qtOCyMGKqwzmkF/nZmXmn x4q/6RIoyD6c1D5IsL9wAJ/l/QjWkN9jqf4cDgBFCJrGpxp1PBRxSXCDl9Rzae4ycTuX /aTvBcruVCco876gEg4k8rTrqY4VswhfKHdlmXptTEwYtsSJiXhg9HiNVqhNEaALDD8R oYaR+Gj5aCXKqvQmqnW6R3DawMwEAlyoxM1MjRSdJjFZS+2IfXlRaHNuXvi5BQJCAKQV TE/wEpGhujMVZQXS/JmRng/f86EGxZzHpNIJFKADDQ7XtYCDxSfOIV9s6pvYqdOiGlS/ oBYQ== 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=yGjCethwPTHq5Rmv8v4renPguUkZTnu5+b6rK3EfYy8=; b=JX8nydWluiVWWEqkr6ypWG0mPS8OGcCysZrcxeBnp25CRoq3aUDtEEWwi5z7396wri +vzXy5fkmrrSlT0QB5oWcWhgTaLamdDXbtcdQTHD2IB8M3JTDu4y9MwH8iGovNqY1mQG 43mS5KKXI8O2HUBqA9eTFZ6gHpcuueOVz5+dMyupEyDWWuLkc3mw1W09nuxYox5NlYou 8JjZWE5ij+PHUcBOpwW+/tL8H+E3t7R545naDlcqXzyrXZ5ZGS5lpQp+uULJ15TZkdgY h9bB388REhcfcX38gQ+qzwF+btASgcCoK6gxGnVLDTx8v4lzfvNK7P5lPTqmb1Kpgagg ASaA== 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 a25si2878544pfc.409.2018.04.10.16.19.41; Tue, 10 Apr 2018 16:20: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 S1755599AbeDJXOl (ORCPT + 99 others); Tue, 10 Apr 2018 19:14:41 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:40856 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754933AbeDJWcO (ORCPT ); Tue, 10 Apr 2018 18:32:14 -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 CAB95A47; Tue, 10 Apr 2018 22:32:13 +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.15 143/168] net: fool proof dev_valid_name() Date: Wed, 11 Apr 2018 00:24:45 +0200 Message-Id: <20180410212807.172759547@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180410212800.144079021@linuxfoundation.org> References: <20180410212800.144079021@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.15-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 @@ -1027,7 +1027,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;