Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1821907imm; Mon, 3 Sep 2018 10:18:50 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdb+QqqHatx2JBb4eWG2y/pNtAAaEj3nYAqgN0CKXFQ0pPpAVL2eOqDlLcXM7ULP7K+uIJd4 X-Received: by 2002:a62:1e81:: with SMTP id e123-v6mr30347365pfe.24.1535995130475; Mon, 03 Sep 2018 10:18:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535995130; cv=none; d=google.com; s=arc-20160816; b=rnTtllw7/hrj91p2vCpPot9WhZIIBqHuGOl1mbzjv+ttIeDHwPeaHLE/xx9APdD4Tp JqJLJ7wrFpX2q36clprRiGaa9z1pYlKOtwuReE/HR8qgWj8CbRXv/2SVU1G3tOHOiN3j s5KEvGoXjw+sUIrK/rbezdZO7dfRTKqgmhG3jR2cBIp/vmQrZKGFlQ8b6EI3p/cqcp1F +Zmg782+S1nLxKrKEMVRmiookTwqFIm5FSLkioCn/Bm4Z2pQaQtRZsYRR2MY7uQFEFhE fQpcFemwpLydigocpTcG6GFVqpN1NI8HxqM4+8YDOyHEx5BC4yMr6geDkuUUf0D4V5AZ zTEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=mCKCO13z5jz+aTaGOyUcf9c9zkmu/Qni+9zHXR+uPUU=; b=Pw8UBwdWd0gVorzbbfCDVu5z91UFqIH3BCT0hJSwTWG9k7/7GjINqBgT9YPyGDmore hpHXc0OjFWuPos6nAECFuAMGBeJqT3XuOrabpfg6bFdleu4fyD4fEE2UkURXjZoaPHBW m9kRgRU0a4UsU0Eaml9zCow8b+ide7CttRXFXOrmZ98qPrfi9z/AQOlUC7T9w4FSRmAb v5EhBhfq0FZkdemIc98uQNb97cOt5dSFUzOtKKb1M30uE5pKpMLs16rvFfxVPXd1VMtq 9u2JYYdUDJfFJsNnC2zVnPBdYUfknZ/KvKJ40XV79BFnol9LNC6VTqxNCzEmTaQ3oW8q Lvig== ARC-Authentication-Results: i=1; mx.google.com; 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 34-v6si19191769plm.205.2018.09.03.10.18.35; Mon, 03 Sep 2018 10:18:50 -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; 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 S1730171AbeICVig (ORCPT + 99 others); Mon, 3 Sep 2018 17:38:36 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:42808 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728624AbeICVig (ORCPT ); Mon, 3 Sep 2018 17:38:36 -0400 Received: from localhost (ip-213-127-74-90.ip.prioritytelecom.net [213.127.74.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 5275DD16; Mon, 3 Sep 2018 17:17:31 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shubhrajyoti Datta , "David S. Miller" , Sasha Levin Subject: [PATCH 4.14 046/165] net: axienet: Fix double deregister of mdio Date: Mon, 3 Sep 2018 18:55:32 +0200 Message-Id: <20180903165657.440930700@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180903165655.003605184@linuxfoundation.org> References: <20180903165655.003605184@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Shubhrajyoti Datta [ Upstream commit 03bc7cab7d7218088412a75e141696a89059ab00 ] If the registration fails then mdio_unregister is called. However at unbind the unregister ia attempted again resulting in the below crash [ 73.544038] kernel BUG at drivers/net/phy/mdio_bus.c:415! [ 73.549362] Internal error: Oops - BUG: 0 [#1] SMP [ 73.554127] Modules linked in: [ 73.557168] CPU: 0 PID: 2249 Comm: sh Not tainted 4.14.0 #183 [ 73.562895] Hardware name: xlnx,zynqmp (DT) [ 73.567062] task: ffffffc879e41180 task.stack: ffffff800cbe0000 [ 73.572973] PC is at mdiobus_unregister+0x84/0x88 [ 73.577656] LR is at axienet_mdio_teardown+0x18/0x30 [ 73.582601] pc : [] lr : [] pstate: 20000145 [ 73.589981] sp : ffffff800cbe3c30 [ 73.593277] x29: ffffff800cbe3c30 x28: ffffffc879e41180 [ 73.598573] x27: ffffff8008a21000 x26: 0000000000000040 [ 73.603868] x25: 0000000000000124 x24: ffffffc879efe920 [ 73.609164] x23: 0000000000000060 x22: ffffffc879e02000 [ 73.614459] x21: ffffffc879e02800 x20: ffffffc87b0b8870 [ 73.619754] x19: ffffffc879e02800 x18: 000000000000025d [ 73.625050] x17: 0000007f9a719ad0 x16: ffffff8008195bd8 [ 73.630345] x15: 0000007f9a6b3d00 x14: 0000000000000010 [ 73.635640] x13: 74656e7265687465 x12: 0000000000000030 [ 73.640935] x11: 0000000000000030 x10: 0101010101010101 [ 73.646231] x9 : 241f394f42533300 x8 : ffffffc8799f6e98 [ 73.651526] x7 : ffffffc8799f6f18 x6 : ffffffc87b0ba318 [ 73.656822] x5 : ffffffc87b0ba498 x4 : 0000000000000000 [ 73.662117] x3 : 0000000000000000 x2 : 0000000000000008 [ 73.667412] x1 : 0000000000000004 x0 : ffffffc8799f4000 [ 73.672708] Process sh (pid: 2249, stack limit = 0xffffff800cbe0000) Fix the same by making the bus NULL on unregister. Signed-off-by: Shubhrajyoti Datta Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c @@ -218,6 +218,7 @@ issue: ret = of_mdiobus_register(bus, np1); if (ret) { mdiobus_free(bus); + lp->mii_bus = NULL; return ret; } return 0;