Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753897AbbBETda (ORCPT ); Thu, 5 Feb 2015 14:33:30 -0500 Received: from smtp.codeaurora.org ([198.145.11.231]:34487 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751548AbbBETd2 (ORCPT ); Thu, 5 Feb 2015 14:33:28 -0500 Message-ID: <54D3C587.9020309@codeaurora.org> Date: Thu, 05 Feb 2015 11:33:27 -0800 From: Stephen Boyd User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Alban Browaeys , Tomeu Vizoso , Mike Turquette CC: linux-kernel@vger.kernel.org, Alban Browaeys Subject: Re: [PATCH 2/2] clk: Fix OOPS calling hlist_del on an already poisoned hlist. References: <1423160690-7853-1-git-send-email-prahal@yahoo.com> <1423160690-7853-2-git-send-email-prahal@yahoo.com> In-Reply-To: <1423160690-7853-2-git-send-email-prahal@yahoo.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1729 Lines: 55 On 02/05/15 10:24, Alban Browaeys wrote: > Put is called more than once, thus hlist_del ends up on a poisoned > list. Why is clk_put() called more than once on the same clk pointer? Where does this happe > > Move hlist_del to the __clk_release handler managed by kref instead > of calling it in _clk_put. > > Fixes: 1c8e600440c7 ("clk: Add rate constraints to clocks") > Signed-off-by: Alban Browaeys > --- > drivers/clk/clk.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c > index 8f33722..f1d4b33 100644 > --- a/drivers/clk/clk.c > +++ b/drivers/clk/clk.c > @@ -2489,6 +2489,9 @@ static void __clk_release(struct kref *ref) > struct clk *clk = container_of(&core, struct clk, core); > int i = core->num_parents; > > + hlist_del(&clk->child_node); > + clk_core_set_rate_nolock(clk->core, clk->core->req_rate); > + > kfree(core->parents); > while (--i >= 0) > kfree_const(core->parent_names[i]); > @@ -2666,8 +2669,6 @@ void __clk_put(struct clk *clk) > > clk_prepare_lock(); > > - hlist_del(&clk->child_node); Ugh we should call this clks_node or something so that we don't confuse it with child_node in clk_core. > - clk_core_set_rate_nolock(clk->core, clk->core->req_rate); > owner = clk->core->owner; > kref_put(&clk->core->ref, __clk_release); > -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project -- 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/