From patchwork Sun Feb 16 14:45:20 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ezequiel Garcia X-Patchwork-Id: 3658121 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 35226BF13A for ; Sun, 16 Feb 2014 14:46:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 206CB201DE for ; Sun, 16 Feb 2014 14:46:44 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B3820201BC for ; Sun, 16 Feb 2014 14:46:42 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WF2yq-0007rf-Dm; Sun, 16 Feb 2014 14:46:04 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WF2yn-0002W8-PY; Sun, 16 Feb 2014 14:46:01 +0000 Received: from casper.infradead.org ([2001:770:15f::2]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WF2yl-0002W2-9B for linux-arm-kernel@merlin.infradead.org; Sun, 16 Feb 2014 14:45:59 +0000 Received: from top.free-electrons.com ([176.31.233.9] helo=mail.free-electrons.com) by casper.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WF2yi-0007qu-O0 for linux-arm-kernel@lists.infradead.org; Sun, 16 Feb 2014 14:45:57 +0000 Received: by mail.free-electrons.com (Postfix, from userid 106) id B7051825; Sun, 16 Feb 2014 15:45:35 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from localhost (unknown [190.2.98.212]) by mail.free-electrons.com (Postfix) with ESMTPSA id 1377761B; Sun, 16 Feb 2014 15:45:33 +0100 (CET) Date: Sun, 16 Feb 2014 11:45:20 -0300 From: Ezequiel Garcia To: Mikael Pettersson Subject: Re: [REGRESSION] 3.14-rc2 boot failure on Kirkwood (qnap ts-119p+) Message-ID: <20140216143735.GA8680@localhost> References: <21248.39509.418884.931848@gargle.gargle.HOWL> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <21248.39509.418884.931848@gargle.gargle.HOWL> User-Agent: Mutt/1.5.21 (2010-09-15) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140216_144556_852653_CB56689B X-CRM114-Status: GOOD ( 26.78 ) X-Spam-Score: -1.8 (-) Cc: Andrew Lunn , linux-arm-kernel@lists.infradead.org, linux-ide@vger.kernel.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Mikael, On Sun, Feb 16, 2014 at 12:00:37PM +0100, Mikael Pettersson wrote: > My Kirkwood box worked fine with the 3.13 kernel, but with 3.14-rc2 > boot always fails due to a kernel NULL dereference in __clk_put. > > This is a non-DT kernel, with: > > CONFIG_ARCH_KIRKWOOD=y > CONFIG_KIRKWOOD_LEGACY=y > CONFIG_MACH_TS219=y > # CONFIG_ARCH_KIRKWOOD_DT is not set > Thanks for the report. I thought this issue was already fixed, but I cannot find it on either the mailing lists or linux-next. So, in case it hasn't been fixed here's an untested fix for you to test. Please try this patch and let us know. Your SATA won't work but if the patch is OK the kernel wont't blow away. Andrew? Do we support the new phy requirement in non-DT platforms? From 5d4010ba3c485e7e22887408663fb260f628b9b2 Mon Sep 17 00:00:00 2001 From: Ezequiel Garcia Date: Sun, 16 Feb 2014 11:21:50 -0300 Subject: [PATCH] ata: sata_mv: Cleanup only the initialized ports When an error occurs in the port initialization loop, currently the driver tries to cleanup all the ports. This results in a NULL pointer dereference if the ports were only partially initialized. Fix this by updating only the number of initialized ports (either with failure or successfully), before jumping to the error path and looping over that number in the cleanup loop. Cc: Andrew Lunn Reported-by: Mikael Pettersson Signed-off-by: Ezequiel Garcia --- drivers/ata/sata_mv.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c index 20a7517..9c1a11d 100644 --- a/drivers/ata/sata_mv.c +++ b/drivers/ata/sata_mv.c @@ -4104,7 +4104,6 @@ static int mv_platform_probe(struct platform_device *pdev) if (!hpriv->port_phys) return -ENOMEM; host->private_data = hpriv; - hpriv->n_ports = n_ports; hpriv->board_idx = chip_soc; host->iomap = NULL; @@ -4132,11 +4131,17 @@ static int mv_platform_probe(struct platform_device *pdev) hpriv->port_phys[port] = NULL; if ((rc != -EPROBE_DEFER) && (rc != -ENODEV)) dev_warn(&pdev->dev, "error getting phy"); + + /* Cleanup only the initialized ports */ + hpriv->n_ports = port; goto err; } else phy_power_on(hpriv->port_phys[port]); } + /* All the ports have been initialized */ + hpriv->n_ports = n_ports; + /* * (Re-)program MBUS remapping windows if we are asked to. */ @@ -4174,7 +4179,7 @@ err: clk_disable_unprepare(hpriv->clk); clk_put(hpriv->clk); } - for (port = 0; port < n_ports; port++) { + for (port = 0; port < hpriv->n_ports; port++) { if (!IS_ERR(hpriv->port_clks[port])) { clk_disable_unprepare(hpriv->port_clks[port]); clk_put(hpriv->port_clks[port]);