Messages in this thread | | | Subject | Re: [PATCH] clk: s2mps11: Fix double free corruption during driver unbind | From | Krzysztof Kozlowski <> | Date | Fri, 27 Jun 2014 14:03:14 +0200 |
| |
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@samsung.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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |