Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1509144ybb; Sat, 11 Apr 2020 05:16:25 -0700 (PDT) X-Google-Smtp-Source: APiQypInybhPW4O1Hk+zvXd9+ZKGRv+CPam8fFkw+UqV9iAWHPFBbb86e1XyI1EaEhaXHaUZRh4Q X-Received: by 2002:a37:8503:: with SMTP id h3mr7807361qkd.499.1586607385064; Sat, 11 Apr 2020 05:16:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586607385; cv=none; d=google.com; s=arc-20160816; b=C/IBnKyxalpPKTQeEAjwK0nsp3CD4W2xsXMLRB2tIhrdj4F/rYugOHwjtKLbqFZ0wF d89asSmBv2RoZDeOKK2QU1z8cTEqV0VtlqGmIGk66N4F/PHzOfRhZ3x3WJTbB7S/4V91 xSL3fnMS4/VMv96lhSQY0I1qsfZE3sFg8RgdGEos0GjV+WgL6WJDpf4HmULcXTxVoezW KaZG1DUWcE24+ggugPRoTyPfEqBYJHc4WcEit8onnXjUaWndJa20N9OjDOP1MTHzR1LT qRvC2yuIwCrpCWzDw64R5uUNsvYqs0l06WxbtpC/obS6iOdfEzRzL9mLvBarZbUP88p+ XhMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=KV3KHy8YVVd39zXhslPShCQx6LrkWLCUErVkNxIgZrU=; b=Op7xVKMBpLG2HmqDUpBnjWoNCmVFfSiB+gTAJZg1utAqWYDCkJQ49Dxfld0o2zNeBh sKL0mrYvNGVrM6HLaFI6yGlS2RDS5f5pRaPTZMjPxknAZGOqQ27yQ6NCo4nnypC8EqzN DQ0PtPuOweu5xia7FkfKjylfXH7CCPPUHpmfJ/SYrSpqxuSsoPbzImOW/wSWIK+Coi64 hPr5aAibO8Np4/nb4LIMMSEF8QG1/6/pXPILwokkSMSvcoWC3JH3oOQrAU3CERJlQ2l9 bTOU8bJqK2juDfj73NlntmDeNqTy2rog8Uo2efV2yHlcHZg6xAxwKeY19IM/Pglf4Rea 3Kqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=RDydOwsA; 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 w6si2636326qts.244.2020.04.11.05.16.10; Sat, 11 Apr 2020 05:16: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=@kernel.org header.s=default header.b=RDydOwsA; 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 S1727473AbgDKMPg (ORCPT + 99 others); Sat, 11 Apr 2020 08:15:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:49524 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728121AbgDKMPe (ORCPT ); Sat, 11 Apr 2020 08:15:34 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3FDDA20644; Sat, 11 Apr 2020 12:15:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586607334; bh=pOhhefnT3vt7QwB756HsUerLLEmN5XhypxWbbN3FghQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RDydOwsAIrb3GnqxfC2VgY3FYB/7SJnb2tF3a/z00WvdGEipv48z/WkkKQTOjUXSI gkm7rw4dMrerC7MNLqnz9zk0E3lUirOPJEVmQD2oMgl1fysJIFhlohPkwxRfYnbXzP f3k/vxsPcu0UfmAnT6xfn5w2Wx9kh8+Cs3d4A+Ds= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jisheng Zhang , "David S. Miller" Subject: [PATCH 4.19 32/54] net: stmmac: dwmac1000: fix out-of-bounds mac address reg setting Date: Sat, 11 Apr 2020 14:09:14 +0200 Message-Id: <20200411115511.659292266@linuxfoundation.org> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200411115508.284500414@linuxfoundation.org> References: <20200411115508.284500414@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jisheng Zhang [ Upstream commit 3e1221acf6a8f8595b5ce354bab4327a69d54d18 ] Commit 9463c4455900 ("net: stmmac: dwmac1000: Clear unused address entries") cleared the unused mac address entries, but introduced an out-of bounds mac address register programming bug -- After setting the secondary unicast mac addresses, the "reg" value has reached netdev_uc_count() + 1, thus we should only clear address entries if (addr < perfect_addr_number) Fixes: 9463c4455900 ("net: stmmac: dwmac1000: Clear unused address entries") Signed-off-by: Jisheng Zhang Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c @@ -218,7 +218,7 @@ static void dwmac1000_set_filter(struct reg++; } - while (reg <= perfect_addr_number) { + while (reg < perfect_addr_number) { writel(0, ioaddr + GMAC_ADDR_HIGH(reg)); writel(0, ioaddr + GMAC_ADDR_LOW(reg)); reg++;