[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-id: <1403870594.3872.0.camel@AMDC1943>
Date: Fri, 27 Jun 2014 14:03:14 +0200
From: Krzysztof Kozlowski <k.kozlowski@...sung.com>
To: Yadwinder Singh Brar <yadi.brar01@...il.com>
Cc: Mike Turquette <mturquette@...aro.org>,
linux-kernel <linux-kernel@...r.kernel.org>,
Kyungmin Park <kyungmin.park@...sung.com>,
Marek Szyprowski <m.szyprowski@...sung.com>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>,
Tomasz Figa <t.figa@...sung.com>,
Yadwinder Singh Brar <yadi.brar@...sung.com>,
Tushar Behera <tushar.behera@...aro.org>
Subject: Re: [PATCH] clk: s2mps11: Fix double free corruption during driver
unbind
On piÄ…, 2014-06-27 at 17:19 +0530, Yadwinder Singh Brar wrote:
> Hi Krzystof,
>
> On Fri, Jun 27, 2014 at 4:04 PM, Krzysztof Kozlowski
> <k.kozlowski@...sung.com> wrote:
> > After unbinding the driver memory was corrupted by double free of
> > clk_lookup structure. This lead to OOPS when re-binding the driver
> > again.
> >
> > The driver allocated memory for 'clk_lookup' with devm_kzalloc. During
> > driver removal this memory was freed twice: once by clkdev_drop() and
> > second by devm code.
> >
>
> Ideally memory should be allocated and deallocated in same place
> either driver or framework, so in this case if framework(clkdev_drop)
> deallocates memory, framework itself should also allocate it.
> So IMO this bug should be fixed using clkdev_alloc() instead of kzalloc().
>
You're right, I'll send fixed version. Thanks for idea.
Best regards,
Krzysztof
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists