Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp702096imm; Wed, 18 Jul 2018 09:12:25 -0700 (PDT) X-Google-Smtp-Source: AAOMgpewyjwkhgmDge8nB7V+3w6n0ZCg4j5lYU1ZfQnEHOM3XUihSTuC3GC6gc8kPXfgp6gE4eYD X-Received: by 2002:a62:3703:: with SMTP id e3-v6mr5839647pfa.117.1531930345666; Wed, 18 Jul 2018 09:12:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531930345; cv=none; d=google.com; s=arc-20160816; b=inLca3OkEQvHqXOQTff7UtwTtf6nAa+EXmuAiPVaPbGzpadVWRzLS4uc+v57ibIn4O DfdmRCDyEr2lNOnJFjogJJtnhanjOW0EAZEp9AWorwqnvVdnbOcFimoZJDDSiJmixSs2 biqSFYfg18X+rsM9NzA1yixT9Xk7K/Hfni5gyB26QLjtyQFvbhsWmY2cbBirrN1//W9Q 27i82viCNFtKArKOpWhhPA/xvOP0obSY1hyuDM+TwcTPMbSGB6s4eeE6oJJamXvtVnUO 4bJEPCJNV205WcYdlfuds8JPSqxhRCMnq6Dlt+245aV8Iu7FRIBmhPlizTvdH1mzLqBt fk0A== 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:arc-authentication-results; bh=EirWCWel/w1jaSio88cM+pYKnpg1qeQaHBKU4yixNfc=; b=j+vJF9+fW6sKcYJ6npGCxe+VKwuVtnSR5+3Dqz4s6epvxmLIyhJmKlScAdSVrOgW1P eAhnNdy9MHDGPcYFEj/Z37/rAH5ZqMkyQLpljCAd+T2Pw3weVg9EsQu4G7byr35hZchj hZQVqHtXJMw3eFPIWm7kaXgqz5GlcVZL/rCaJqbS+LE6Aw/MuSfLuIyTAmg9yixd5LTv qLJp4szLisO2luYyUXFezcums3oOjFEvoDuqb6LltHFMdiMGlET596AHU0/G1JewDDfK baX6IwLlum9h6eRqdJIZ4RLTgvd461vrAZAlIxqo+koLXFy981/I/zNg1VJ+CxQ1TGJx uUDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=EHtJuWoO; 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 z21-v6si3593580pgn.365.2018.07.18.09.12.03; Wed, 18 Jul 2018 09:12:25 -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=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=EHtJuWoO; 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 S1731593AbeGRQtX (ORCPT + 99 others); Wed, 18 Jul 2018 12:49:23 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:53394 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731541AbeGRQtW (ORCPT ); Wed, 18 Jul 2018 12:49:22 -0400 Received: by mail-wm0-f65.google.com with SMTP id s9-v6so3349541wmh.3 for ; Wed, 18 Jul 2018 09:10:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=EirWCWel/w1jaSio88cM+pYKnpg1qeQaHBKU4yixNfc=; b=EHtJuWoO8ddLvvPcVimKtHq6H8FCzhnH+7pzF5jw6GaqcXYVULCbQvQoyIn5ASUyEm f7zDWC1QrVN92CcoQW57/gEo0uIRrlNSgjl6n0hRexuov7WOocKC1Fsi4g+s+ZOL5n9T x1FeKQIU2dJuVrK86D0Gf+TK6S3Kpq2bWh4NpwmZDQV5+5d1FzUiLYZo83fVWqi1Oaf0 zqmmGgn7yTu/xMdApC0AIDaBQn8k+pSar5skAgB4lzqTgdlFxQLdNLfldfINYhgp/ZWZ WhuqQUdLp5TRmP+6JAOU/I6o2o+NfvgObBZVHLDVsc4URiyW8BtTsdT7rfDrKzcsKdj4 NTJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=EirWCWel/w1jaSio88cM+pYKnpg1qeQaHBKU4yixNfc=; b=CbgQqG5E8JJWhev1tc/dgpWYs+Jl8mUEJTgWNIvIW6z0GaFVMpHmqwnrCQ7M9NqF4i c1oEpOGjCN4arkZ7wsPieQ0zu+1PgzebIOyrfp8rMuqI+EULlRYcOnw2t6NQBT24goCW V5hczlkkhNG8Z86TARG18ga5+/501d/5+stHBJ1wDBD+IOFxJON/zZqYFDLgJn0hk7TR U4klzVlR6d81jEzC0o8+05sjyn1Qgmk6pmsqywQeWTor86SgzZ9FXxCsgVQkZ6k8bAZI aFk3brZ5Pl3aTgZ0LXko8UoXlF7RMbiCp5lxho5H5Pj1V6SkyL4eAI6siBPpLj46DaxQ BZJQ== X-Gm-Message-State: AOUpUlHizdjujv1vDmboqRxQqh37Z2X0xAQKBTAObC0NqYJzn6fURrU+ pe9aIaDVdNSC1bYbdkFlSGB8gA== X-Received: by 2002:a1c:369c:: with SMTP id y28-v6mr1923561wmh.34.1531930246398; Wed, 18 Jul 2018 09:10:46 -0700 (PDT) Received: from brgl-bgdev.home ([2a01:cb1d:af:5b00:e837:b8d5:48c1:571b]) by smtp.gmail.com with ESMTPSA id v185-v6sm2847803wme.30.2018.07.18.09.10.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Jul 2018 09:10:45 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Russell King , Grygorii Strashko , "David S . Miller" , Srinivas Kandagatla , Lukas Wunner , Rob Herring , Florian Fainelli , Dan Carpenter , Ivan Khoronzhuk , David Lechner , Greg Kroah-Hartman , Andrew Lunn Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, netdev@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 3/5] net: fortify eth_platform_get_mac_address() Date: Wed, 18 Jul 2018 18:10:33 +0200 Message-Id: <20180718161035.7005-4-brgl@bgdev.pl> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180718161035.7005-1-brgl@bgdev.pl> References: <20180718161035.7005-1-brgl@bgdev.pl> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bartosz Golaszewski We'll soon have more sources from which to read the MAC address in this routine. Make sure the address is correct before returning it. Signed-off-by: Bartosz Golaszewski --- net/ethernet/eth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c index 2a2173324d9e..6b64586fd2af 100644 --- a/net/ethernet/eth.c +++ b/net/ethernet/eth.c @@ -544,7 +544,7 @@ int eth_platform_get_mac_address(struct device *dev, u8 *mac_addr) from = "arch callback"; } - if (!addr) + if (!addr || !is_valid_ether_addr(addr)) return -ENODEV; dev_info(dev, "read MAC address from %s\n", from); -- 2.17.1