Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1434476imm; Thu, 19 Jul 2018 01:21:53 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc1LinX+EP9iMJi1h6Lt5/NXfxlP1xy9gjqFASV0Y8f15PBovvKOrs1/MsN6ZqJCXfX/xq6 X-Received: by 2002:a17:902:1121:: with SMTP id d30-v6mr9321179pla.247.1531988513884; Thu, 19 Jul 2018 01:21:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531988513; cv=none; d=google.com; s=arc-20160816; b=n89kYizUuJ4fVaca0nRD8Mp0sQ8XhSy2abtFtUVJo5AQNSCxCxJV9mKT2jO9cikIVI YM3vy8n/UVOR4Mo1irYCii4uxtpqBZUHNDD7DOHBiRqu6X2pH4PheHff9lqXOud30VXo f8QcJM3w2TDt+p8Wj63gt/41/zJoqw+STnaQEt+vLxXqSBrU62IYul5QzlniO4HYCf0v Tiww2StOGW7JGPvNULZDtWjuFOt8PXhK76Tk6X9yYxhVusJuFHHgU/wkioBJQ1hkOcGe bG6A300OhP31ci5MqJSiU3PB64qN0thp/ba30SPnwOXRfLuYKysGTme45CUMzw2iseKW 8VgA== 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=GD31JLCNt8L1SLxIII8ZY0h+x0qTpgVuq1EzBxuSJSA=; b=ijZ9pMy/PNgMosA9TYMbXKXSK5I9WKoEr3KDQLfgUwDyxiCxq8tjp7clU4QJIKq6La awV9D7308hO3/WhT6dObO4w5kjhfcW+pNUhoKDxHgDwvyoSEOJAQVvqHv+sYaCBQWJoZ UA49gQYoE0Qx3O2EYZ4KR5jxVbw+ZRAKnOg8zN+RBTaw5nr9cbAvAbe8/+ihxUT0vJn7 5x/tOtJBWZe+FE5WbzjG5K0mA/o1Ri3DQwtu0XLbg4MzBkemTQKmo6ILx8VFNgdfXsF4 NP1WzeSnTdREmeErba845GSDITzBNv5nYf3EzISHmrAZYyuXniFN/zbTyHnRoa6PslKn m/Kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=acXBfGRW; 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 9-v6si5264044pgm.659.2018.07.19.01.21.39; Thu, 19 Jul 2018 01:21:53 -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=acXBfGRW; 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 S1731541AbeGSJCe (ORCPT + 99 others); Thu, 19 Jul 2018 05:02:34 -0400 Received: from mail-wr1-f43.google.com ([209.85.221.43]:44547 "EHLO mail-wr1-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731186AbeGSJCd (ORCPT ); Thu, 19 Jul 2018 05:02:33 -0400 Received: by mail-wr1-f43.google.com with SMTP id r16-v6so7108894wrt.11 for ; Thu, 19 Jul 2018 01:20:33 -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=GD31JLCNt8L1SLxIII8ZY0h+x0qTpgVuq1EzBxuSJSA=; b=acXBfGRWXA+I7bgMj+okioJKnjvjKMxDAjJCYaxQ5hKnn/ipAd1NRzrxqxLV592499 1OrX01twt4O2CD/Y1Cim4696UHEG2VQPJodmSR/x1xSPbxQGRsXyTw1JwoKG81rC7PA+ HKHeezw90jdaxQ3lOg96we+jMUKeG/NvUmgcIdMR1u+vBBG7knHNEuMoAgx7REj3NuYX USu5QLc+6zKbdtAdyQu9dVWDN5NXC7BI26IpV6gwVMZ1qlG5PymO2QhUijbhsP7eZ7BL 6TqyLvytu7P5+nuc/julJ589qTcrRENnTCVzxUSqZaA5kKNIEOMlCvwOhymBbHgmWJOi 1vfg== 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=GD31JLCNt8L1SLxIII8ZY0h+x0qTpgVuq1EzBxuSJSA=; b=fCKDOjGNgWOpQfKX7Q90IXpPFY1apps2oqH3B2nzsIHZ9LdrKIJL+We8bMAeG3lHqd 7N220yOq4JUSWc2ZxSRIgI2JMVG+H/Yw37ajACxLcy/GgMZiggoMtb48Tfj68sd/sYqI x13ddGv9U0V9gKGSvGAk2U4KzTNkljh9brqUKj7JpJ39a1axQSiSr7FBvl1P08CH7X3k WnGYdeT8ujdbN4RML9TGY7i4nlqmxt+BNrB5fNpNFBbOkW0w9wIqa5zepmlrGpHIVlyU X1B+slPmgXOgNhPBrqLcUqfqHHRxkh8C228tlyfgp/kDvCpFSs86PbGR4ZmeSwON57+M +rRg== X-Gm-Message-State: AOUpUlG8TZ1VOClw5qpxQUVAogCjWIANUB9gb31fnT0afq+0inDKCF+T C0exyRXHfKDth4NIJH/B6BtMpA== X-Received: by 2002:adf:a0f3:: with SMTP id n48-v6mr6946521wrn.23.1531988433260; Thu, 19 Jul 2018 01:20:33 -0700 (PDT) Received: from brgl-bgdev.baylibre.local (AStLambert-681-1-40-185.w90-86.abo.wanadoo.fr. [90.86.159.185]) by smtp.gmail.com with ESMTPSA id h43-v6sm1716338wrh.1.2018.07.19.01.20.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Jul 2018 01:20:32 -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 v2 1/3] net: fortify eth_platform_get_mac_address() Date: Thu, 19 Jul 2018 10:20:26 +0200 Message-Id: <20180719082028.26116-2-brgl@bgdev.pl> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180719082028.26116-1-brgl@bgdev.pl> References: <20180719082028.26116-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 Reviewed-by: Andrew Lunn --- 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 ee28440f57c5..39af03894598 100644 --- a/net/ethernet/eth.c +++ b/net/ethernet/eth.c @@ -541,7 +541,7 @@ int eth_platform_get_mac_address(struct device *dev, u8 *mac_addr) if (!addr) addr = arch_get_platform_mac_address(); - if (!addr) + if (!addr || !is_valid_ether_addr(addr)) return -ENODEV; ether_addr_copy(mac_addr, addr); -- 2.17.1