Received: by 2002:a17:90b:8d0:0:0:0:0 with SMTP id ds16csp4878031pjb; Mon, 27 Jul 2020 07:25:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy/Schs21fgE4cvsnBJoswaTqNscg3EJhidVAMoR8RMBPqBgRBsmvSmsQU2qJk9N7KQROnt X-Received: by 2002:a05:6402:1544:: with SMTP id p4mr21911610edx.334.1595859932698; Mon, 27 Jul 2020 07:25:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595859932; cv=none; d=google.com; s=arc-20160816; b=ws6lLEx2evCiY8A7UVfBacGGet+svVW8q1CYOqTNNZTh6mC2rZMlJNT8OXCQEXWCKj XN01uNbrGFkeY4VkTFa22uqfQ6veXCh6ADfBxDJGb5EHFfy8zKAkRHyXowKrnGm5Kqnx gjG4o/9bBnb1wE8HxptrbSNsF21F3cPnNLnml7jJ+qIRjG6UgpUxLXjK5NoT2PShskLB EcICnw+McjQliUI6mLXH8LryxNx0J/VYZqwbJTRm58Ww9owcz+IkEbF0N0nft+dzJPVk jFbaZpr2q8kAt9zHn6rIy2wX9+MXpUSV9AIt1/zuDNeBrXeKXtDkc0TvGFisZ2QzKi66 IYnA== 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=8p7gquA+hpiPNLqyvV1Fvw29C1T+KFIq7z1yL6VRZ6E=; b=sXJJOFHnp/S98+UAHv+PrX996rv9VvJPbo1Y3Cf2wPNfYoszgJCcVtGrIV9NQpp9Uy bv0C/+8r5oJZlQShsuoygE8JhLgKk1a3aqbYRXILJra4H194SFI0woOZ4UokoyJgzzN2 cQQJyamTioKZooGeZXwOQKkQvVL1UhEVgV8aMchMj1nV0slwSNeCkB37YIoDQPF3ilqv yXHzLVBNYnLdPWmXI9kOwHmxx7SaeNYfvKtxh0kmOPfEO3Z1XK/cv5KVzUxb8V/cZkbv 8/kPrayj1j5p4zwWZKPgrBHseYAc9dzb85NuCpCC1VmJTFHF7wsBQ/aTJKUsvc6kJLze /kcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=A+XnPq4h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i5si3657900edn.13.2020.07.27.07.25.10; Mon, 27 Jul 2020 07:25:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=A+XnPq4h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732163AbgG0OXv (ORCPT + 99 others); Mon, 27 Jul 2020 10:23:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:53148 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732148AbgG0OXr (ORCPT ); Mon, 27 Jul 2020 10:23:47 -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 9CDCE22BF5; Mon, 27 Jul 2020 14:23:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595859827; bh=L+hvxD0ShNgRiW665zZgeC/VRcIF7HA/LgIxcg0wf7E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A+XnPq4h4MHdOqH/dBFeU+bk0iDUQAwyaCMyazCLB4Tav2+t0PU4dzRtuvfjJeinw C3/Gb5FHbNhSd5InpKOgJMtapwVjxhd5TMCb5E+lhvBvGk1ySbp9238AbgMDAu1hIz 1etTvRQMxvSlPqHLb2nEoTzsRSaOvJEaT3N6Wamo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Claudiu Manoil , "David S. Miller" , Sasha Levin Subject: [PATCH 5.7 090/179] enetc: Remove the mdio bus on PF probe bailout Date: Mon, 27 Jul 2020 16:04:25 +0200 Message-Id: <20200727134937.059668605@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200727134932.659499757@linuxfoundation.org> References: <20200727134932.659499757@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: Claudiu Manoil [ Upstream commit 26cb7085c8984e5b71d65c374a135134ed8cabb3 ] For ENETC ports that register an external MDIO bus, the bus doesn't get removed on the error bailout path of enetc_pf_probe(). This issue became much more visible after recent: commit 07095c025ac2 ("net: enetc: Use DT protocol information to set up the ports") Before this commit, one could make probing fail on the error path only by having register_netdev() fail, which is unlikely. But after this commit, because it moved the enetc_of_phy_get() call up in the probing sequence, now we can trigger an mdiobus_free() bug just by forcing enetc_alloc_msix() to return error, i.e. with the 'pci=nomsi' kernel bootarg (since ENETC relies on MSI support to work), as the calltrace below shows: kernel BUG at /home/eiz/work/enetc/net/drivers/net/phy/mdio_bus.c:648! Internal error: Oops - BUG: 0 [#1] PREEMPT SMP [...] Hardware name: LS1028A RDB Board (DT) pstate: 80000005 (Nzcv daif -PAN -UAO BTYPE=--) pc : mdiobus_free+0x50/0x58 lr : devm_mdiobus_free+0x14/0x20 [...] Call trace: mdiobus_free+0x50/0x58 devm_mdiobus_free+0x14/0x20 release_nodes+0x138/0x228 devres_release_all+0x38/0x60 really_probe+0x1c8/0x368 driver_probe_device+0x5c/0xc0 device_driver_attach+0x74/0x80 __driver_attach+0x8c/0xd8 bus_for_each_dev+0x7c/0xd8 driver_attach+0x24/0x30 bus_add_driver+0x154/0x200 driver_register+0x64/0x120 __pci_register_driver+0x44/0x50 enetc_pf_driver_init+0x24/0x30 do_one_initcall+0x60/0x1c0 kernel_init_freeable+0x1fc/0x274 kernel_init+0x14/0x110 ret_from_fork+0x10/0x34 Fixes: ebfcb23d62ab ("enetc: Add ENETC PF level external MDIO support") Signed-off-by: Claudiu Manoil Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/freescale/enetc/enetc_pf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf.c b/drivers/net/ethernet/freescale/enetc/enetc_pf.c index 438648a06f2ae..041e19895adfa 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pf.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.c @@ -919,6 +919,7 @@ static int enetc_pf_probe(struct pci_dev *pdev, return 0; err_reg_netdev: + enetc_mdio_remove(pf); enetc_of_put_phy(priv); enetc_free_msix(priv); err_alloc_msix: -- 2.25.1