From patchwork Thu Sep 24 19:36:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Russell King X-Patchwork-Id: 7260551 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 68DD8BEEC1 for ; Thu, 24 Sep 2015 19:39:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8B2D72070D for ; Thu, 24 Sep 2015 19:39:38 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6FE1C2087E for ; Thu, 24 Sep 2015 19:39:37 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZfCLK-0007VT-QJ; Thu, 24 Sep 2015 19:38:10 +0000 Received: from pandora.arm.linux.org.uk ([78.32.30.218]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZfCL4-0006mP-K2 for linux-arm-kernel@lists.infradead.org; Thu, 24 Sep 2015 19:37:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=arm.linux.org.uk; s=pandora-2014; h=Date:Sender:Message-Id:Content-Type:Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References:In-Reply-To; bh=ibtGfhXHw/6hMnK6akqAtGbmzR+CNwrJtS1ksovRzSQ=; b=aJ4Qjjk0or969mn3ZKdto10dU5ll97L3HtvLTMwT2XeShIYM5L/7K0JTZnT6y0VqY2AeNPjFxVGGjcVGFN9CvbbycQqaXD9KXTtna4B4w3LEG40gaFAPdbtKVhw4T+eTUYjqcoB+ksxNu9mfBObQ6B3JUc7uTUGdNm7ysiKWZf8=; Received: from e0022681537dd.dyn.arm.linux.org.uk ([2001:4d48:ad52:3201:222:68ff:fe15:37dd]:60947 helo=rmk-PC.arm.linux.org.uk) by pandora.arm.linux.org.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1ZfCJl-0002X1-Ct; Thu, 24 Sep 2015 20:36:33 +0100 Received: from rmk by rmk-PC.arm.linux.org.uk with local (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1ZfCJb-0004Rx-G8; Thu, 24 Sep 2015 20:36:23 +0100 In-Reply-To: <20150922161710.GA21084@n2100.arm.linux.org.uk> References: <20150922161710.GA21084@n2100.arm.linux.org.uk> From: Russell King To: Florian Fainelli , David Miller Subject: [PATCH RESEND v3 7/9] phy: fixed-phy: properly validate phy in fixed_phy_update_state() MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Thu, 24 Sep 2015 20:36:23 +0100 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150924_123755_209457_ED794135 X-CRM114-Status: GOOD ( 10.14 ) X-Spam-Score: -2.0 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Petazzoni , devicetree@vger.kernel.org, Sunil Goutham , Robert Richter , Frank Rowand , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Rob Herring , Michal Simek , netdev@vger.kernel.org, Soren Brinkmann , Iyappan Subramanian , Grant Likely , Li Yang , Keyur Chudgar , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Validate that the phy_device passed into fixed_phy_update_state() is a fixed-phy device before walking the list of phys for a fixed phy at the same address. Signed-off-by: Russell King --- drivers/net/phy/fixed_phy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/phy/fixed_phy.c b/drivers/net/phy/fixed_phy.c index fb1299c6326e..e23bf5b90e17 100644 --- a/drivers/net/phy/fixed_phy.c +++ b/drivers/net/phy/fixed_phy.c @@ -220,7 +220,7 @@ int fixed_phy_update_state(struct phy_device *phydev, struct fixed_mdio_bus *fmb = &platform_fmb; struct fixed_phy *fp; - if (!phydev || !phydev->bus) + if (!phydev || phydev->bus != fmb->mii_bus) return -EINVAL; list_for_each_entry(fp, &fmb->phys, node) {