From patchwork Thu Jul 19 08:20:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10533793 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CD00D600F4 for ; Thu, 19 Jul 2018 08:21:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BB4322939B for ; Thu, 19 Jul 2018 08:21:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AE9A729438; Thu, 19 Jul 2018 08:21:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5D9902939B for ; Thu, 19 Jul 2018 08:21:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=vlRCfn0MupD0039PGGEx7ru1UjcflXdaYHcMrdH1DSU=; b=uUFTbFyD3v90RZOHccEE20zXIg S6CzmPOr6oHyUz026rVdtWVNdJUeynHAs1MMC3UYJoHNU1SKtDDxTlP0YIsedllLInU6z7w4Ij1Ee 9KhugZJCyplgD2h5Gv0Fd6dpY3T/hukI/zAHH+5rsO05p0PLa487rKPE99vvENdAqG5wQqWJUyIqX 4t8nmZIrqMP4eSwyNXDtkYOAxsOyzkXDvrb3xOm63L7qwvOQJrK/J2Jr4KvVQrZcxTg1Cwbqyumwf Yzw5UVPeJ+g5MvEAmOzIdTC89qVzH/t44IgIlF0Ilc8BKebFZuQ9Ce5EUH+SG1eagxqf3mpZwDLAp 5Tvdi4tg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fg4BK-0006AR-Hp; Thu, 19 Jul 2018 08:21:02 +0000 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fg4B3-0005sn-06 for linux-arm-kernel@lists.infradead.org; Thu, 19 Jul 2018 08:20:46 +0000 Received: by mail-wr1-x432.google.com with SMTP id v14-v6so7129533wro.5 for ; Thu, 19 Jul 2018 01:20:34 -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=evPeGRnz9N42l0a/pxdbw4NLGYlzWd+Bmz6vuDDVWWhbSEuhU4v6a6WsdbMAm7XJeg FOx9MfJ4AUA3EBsiNFfU5qJlcSIMKDT5X4rqoTzOyssA4howuglsWr4lTTmCz8xOn3FP zbLgndlfsI6EZEFMmmZCUlWr6mHdCIqDIgeOUNua/nVQW77R2GlDZdxZQuRKhfrN3gIF Bu0c2dCsGYBUnJv+xUYkhaRokGLVT7QgXb2LAiFbrKhhBlsLu5O5hlZ2YcpZbIxtsvqY SPWLbO+osov7QPiZ59zPRO9WPS/rDJBPImSmCxAtUtpofd9+eI7oPdhdvK7Muz0srccJ /0NA== X-Gm-Message-State: AOUpUlGZjCV64LEukM/iOlg0Obvse57TJuMfXpAyZ8veyisWoggBlRRS b/7yZVNVQgTSedGwlNziU7lBQA== X-Google-Smtp-Source: AAOMgpcEMk0FaEio3Fxu4SiPcEyScKHLARXxtXCIc2tdO5179xaxVdRsVG4LfiY1bp3vsF2Ej5zhyQ== 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180719_012045_040324_6E62E4E9 X-CRM114-Status: GOOD ( 14.71 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Bartosz Golaszewski MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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);