Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2660458imj; Mon, 11 Feb 2019 06:37:32 -0800 (PST) X-Google-Smtp-Source: AHgI3Ia3tajUUJEBMEPLohhgGBkuz9OUgujJ23QFa9EZv5doqXCcLgqMusej3ZL1ieolpz1aT0d+ X-Received: by 2002:a63:ce45:: with SMTP id r5mr34100101pgi.112.1549895852406; Mon, 11 Feb 2019 06:37:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549895852; cv=none; d=google.com; s=arc-20160816; b=jeclByrAIKpzQ7CcT+/LolGC/k49YLQ6u8lcMXr7EWicu4QJsN1WVSAJEK7ljBoMC5 cxTVKWexiwX29uKGN38zVn2OWHIkHbuyUuIAqcGkVFqKAf6pnPiOHmF1Vcpd/yLwn6pw rZX5u0rAhn935Y2PgSUjaW3ht30NEPesA5bnAUwasPxD3yt5Z7gH1lBUQi6IPIpSI0VV PqWJorsgIoaBRvk1/8D2itvA5SwxROsPu+AJEEGDGTwvA7N4tUDe6tFZP7iLQVYFCFlN 3zKGwpYjAHPaGG5K3CEihx9N3YlyDctETiASF+u2OIZH/SgxfUCQt1DRkNgHdWjEpZ9l 3WlA== 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=29kOesXcSZ1q+TshExK2NG4hLIRrMbVyMx74w5CkSSI=; b=YIZEKDBhzGzaLBl3/TF11hDUUP1nVt/izhtaBznEDHsJP+zaO+21nnFIw5iZZ7Vvyl PwOmYkUJxynXN+dzaHXWftfeWqOp/ilgILwCjysM4rCPFuw2sMpPBwz5dFbdgzwCWBaI fl6aBDJTavUWZbu7oIdXLOARCT/8yzYQoWspJ9+UraLh2mxOjU1XHo7X0XNsmAKj0QRO CF1HCgyIHrtdLOPSaXQHaHByEqgUxcuV5GU7t/25m0TDYADJfvh7LIy2sU8uosalm0Ko lHgFKc6cNLTOQeLSvjnnHabX2AeZ109OGzRvhoa4MwiPXWJZ9v6cwKCrVih03HeUfSxw 0+cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JtA9j4UN; 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 h20si6673284pgm.366.2019.02.11.06.37.16; Mon, 11 Feb 2019 06:37:32 -0800 (PST) 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=JtA9j4UN; 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 S1730997AbfBKOfQ (ORCPT + 99 others); Mon, 11 Feb 2019 09:35:16 -0500 Received: from mail.kernel.org ([198.145.29.99]:43840 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730434AbfBKOfP (ORCPT ); Mon, 11 Feb 2019 09:35:15 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.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 6578A20700; Mon, 11 Feb 2019 14:35:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549895713; bh=KnMjIeF8CQZy2S3wB8Nn1HWcXCk5bRKtLmItD1uwALs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JtA9j4UNGMZFr8I1sU13HHDx0X5b+h78wvoDqXMCKUQ2WxtwRLnD2JsWlxuqbTujs +R/4AhhYoltTh0oyP0KqSwPk0qkz3UnXJGNVAQSligULdchi/i1dzJj1M/gmMJpEyW MSucmOMejB5Ai3ZMGJ0tqNGcG16D2XZCQRJgZmPo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chris Healy , Andrew Lunn , "David S. Miller" Subject: [PATCH 4.20 298/352] net: dsa: mv88e6xxx: Fix counting of ATU violations Date: Mon, 11 Feb 2019 15:18:45 +0100 Message-Id: <20190211141905.841758239@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ From: Andrew Lunn [ Upstream commit 75c05a74e745ae7d663b04d75777af80ada2233c ] The ATU port vector contains a bit per port of the switch. The code wrongly used it as a port number, and incremented a port counter. This resulted in the wrong interfaces counter being incremented, and potentially going off the end of the array of ports. Fix this by using the source port ID for the violation, which really is a port number. Reported-by: Chris Healy Tested-by: Chris Healy Fixes: 65f60e4582bd ("net: dsa: mv88e6xxx: Keep ATU/VTU violation statistics") Signed-off-by: Andrew Lunn Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/dsa/mv88e6xxx/global1_atu.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) --- a/drivers/net/dsa/mv88e6xxx/global1_atu.c +++ b/drivers/net/dsa/mv88e6xxx/global1_atu.c @@ -314,6 +314,7 @@ static irqreturn_t mv88e6xxx_g1_atu_prob { struct mv88e6xxx_chip *chip = dev_id; struct mv88e6xxx_atu_entry entry; + int spid; int err; u16 val; @@ -336,6 +337,8 @@ static irqreturn_t mv88e6xxx_g1_atu_prob if (err) goto out; + spid = entry.state; + if (val & MV88E6XXX_G1_ATU_OP_AGE_OUT_VIOLATION) { dev_err_ratelimited(chip->dev, "ATU age out violation for %pM\n", @@ -344,23 +347,23 @@ static irqreturn_t mv88e6xxx_g1_atu_prob if (val & MV88E6XXX_G1_ATU_OP_MEMBER_VIOLATION) { dev_err_ratelimited(chip->dev, - "ATU member violation for %pM portvec %x\n", - entry.mac, entry.portvec); - chip->ports[entry.portvec].atu_member_violation++; + "ATU member violation for %pM portvec %x spid %d\n", + entry.mac, entry.portvec, spid); + chip->ports[spid].atu_member_violation++; } if (val & MV88E6XXX_G1_ATU_OP_MISS_VIOLATION) { dev_err_ratelimited(chip->dev, - "ATU miss violation for %pM portvec %x\n", - entry.mac, entry.portvec); - chip->ports[entry.portvec].atu_miss_violation++; + "ATU miss violation for %pM portvec %x spid %d\n", + entry.mac, entry.portvec, spid); + chip->ports[spid].atu_miss_violation++; } if (val & MV88E6XXX_G1_ATU_OP_FULL_VIOLATION) { dev_err_ratelimited(chip->dev, - "ATU full violation for %pM portvec %x\n", - entry.mac, entry.portvec); - chip->ports[entry.portvec].atu_full_violation++; + "ATU full violation for %pM portvec %x spid %d\n", + entry.mac, entry.portvec, spid); + chip->ports[spid].atu_full_violation++; } mutex_unlock(&chip->reg_lock);