Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934151AbbHLJZi (ORCPT ); Wed, 12 Aug 2015 05:25:38 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:60728 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934381AbbHLI6B (ORCPT ); Wed, 12 Aug 2015 04:58:01 -0400 From: Luis Henriques To: linux-kernel@vger.kernel.org, stable@vger.kernel.org, kernel-team@lists.ubuntu.com Cc: Florian Fainelli , "David S. Miller" , Luis Henriques Subject: [PATCH 3.16.y-ckt 064/118] net: dsa: Fix off-by-one in switch address parsing Date: Wed, 12 Aug 2015 09:56:06 +0100 Message-Id: <1439369820-27005-65-git-send-email-luis.henriques@canonical.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1439369820-27005-1-git-send-email-luis.henriques@canonical.com> References: <1439369820-27005-1-git-send-email-luis.henriques@canonical.com> X-Extended-Stable: 3.16 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1280 Lines: 37 3.16.7-ckt16 -stable review patch. If anyone has any objections, please let me know. ------------------ From: Florian Fainelli commit c8cf89f73f3d9ecbdea479778f0ac714be79be33 upstream. cd->sw_addr is used as a MDIO bus address, which cannot exceed PHY_MAX_ADDR (32), our check was off-by-one. Fixes: 5e95329b701c ("dsa: add device tree bindings to register DSA switches") Signed-off-by: Florian Fainelli Signed-off-by: David S. Miller Signed-off-by: Luis Henriques --- net/dsa/dsa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c index d3ca32dc167f..a3c70870448f 100644 --- a/net/dsa/dsa.c +++ b/net/dsa/dsa.c @@ -418,7 +418,7 @@ static int dsa_of_probe(struct platform_device *pdev) continue; cd->sw_addr = be32_to_cpup(sw_addr); - if (cd->sw_addr > PHY_MAX_ADDR) + if (cd->sw_addr >= PHY_MAX_ADDR) continue; for_each_available_child_of_node(child, port) { -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/