Patchwork rtc/rtc-spear: free the config right after the rtc_device_unregister

login
register
mail settings
Submitter Devendra Naga
Date June 3, 2012, 6:24 a.m.
Message ID <1338704660-30921-1-git-send-email-devendra.aaru@gmail.com>
Download mbox | patch
Permalink /patch/162474/
State New
Headers show

Comments

Devendra Naga - June 3, 2012, 6:24 a.m.
the config was freed and its used again at rtc_device_unregister which leads
to a kernel panic. so, do it right after the rtc_device_unregister

Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
---
 drivers/rtc/rtc-spear.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Devendra Naga - June 20, 2012, 1:32 p.m.

viresh.linux@gmail.com - June 20, 2012, 2:14 p.m.
Hi Devendra,

Please cc spear-devel@list.st.com for any future patches.

On Sunday, June 3, 2012 7:24:19 AM UTC+1, Devendra Naga wrote:
>
> the config was freed and its used again at rtc_device_unregister which 
> leads 
> to a kernel panic. so, do it right after the rtc_device_unregister 
>
> Signed-off-by: Devendra Naga <devendra.aaru@gmail.com> 
> --- 
>  drivers/rtc/rtc-spear.c |    2 +- 
>  1 file changed, 1 insertion(+), 1 deletion(-) 
>
> diff --git a/drivers/rtc/rtc-spear.c b/drivers/rtc/rtc-spear.c 
> index 1f76320..e278547 100644 
> --- a/drivers/rtc/rtc-spear.c 
> +++ b/drivers/rtc/rtc-spear.c 
> @@ -458,12 +458,12 @@ static int __devexit spear_rtc_remove(struct 
> platform_device *pdev) 
>          clk_disable(config->clk); 
>          clk_put(config->clk); 
>          iounmap(config->ioaddr); 
> -        kfree(config); 
>          res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 
>          if (res) 
>                  release_mem_region(res->start, resource_size(res)); 
>          platform_set_drvdata(pdev, NULL); 
>          rtc_device_unregister(config->rtc); 
> +        kfree(config); 
>   
>          return 0; 
>  }


Reviewed-by: Viresh Kumar <viresh.linux@gmail.com>
viresh kumar - June 20, 2012, 2:27 p.m.
Hi,

Sorry for my last mail, replied from some other email id of mine.

On Sunday, June 3, 2012 7:24:19 AM UTC+1, Devendra Naga wrote:
>
> the config was freed and its used again at rtc_device_unregister which 
> leads 
> to a kernel panic. so, do it right after the rtc_device_unregister 
>
> Signed-off-by: Devendra Naga <devendra.aaru@gmail.com> 
> --- 
>  drivers/rtc/rtc-spear.c |    2 +- 
>  1 file changed, 1 insertion(+), 1 deletion(-) 
>
> diff --git a/drivers/rtc/rtc-spear.c b/drivers/rtc/rtc-spear.c 
> index 1f76320..e278547 100644 
> --- a/drivers/rtc/rtc-spear.c 
> +++ b/drivers/rtc/rtc-spear.c 
> @@ -458,12 +458,12 @@ static int __devexit spear_rtc_remove(struct 
> platform_device *pdev) 
>          clk_disable(config->clk); 
>          clk_put(config->clk); 
>          iounmap(config->ioaddr); 
> -        kfree(config); 
>          res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 
>          if (res) 
>                  release_mem_region(res->start, resource_size(res)); 
>          platform_set_drvdata(pdev, NULL); 
>          rtc_device_unregister(config->rtc); 
> +        kfree(config); 
>   
>          return 0; 
>  } 
>

Reviewed-by: Viresh Kumar <viresh.linux@gmail.com>
Devendra Naga - June 20, 2012, 2:39 p.m.
Hi Viresh,

On Wed, Jun 20, 2012 at 7:57 PM, Viresh Kumar <viresh.linux@gmail.com> wrote:
> Reviewed-by: Viresh Kumar <viresh.linux@gmail.com>

Thanks, at last :-).

Is there any tree through which it can reach torvalds?

Thanks,
Devendra.
viresh kumar - June 20, 2012, 2:44 p.m.
On Wed, Jun 20, 2012 at 3:39 PM, devendra.aaru <devendra.aaru@gmail.com> wrote:
> On Wed, Jun 20, 2012 at 7:57 PM, Viresh Kumar <viresh.linux@gmail.com> wrote:
>> Reviewed-by: Viresh Kumar <viresh.linux@gmail.com>
>
> Thanks, at last :-).
>
> Is there any tree through which it can reach torvalds?

The way I would have found this information about any driver is by
looking at its
git-log and check via which path patches have been going till date. Maintainers
normally adds there signed-off's to patches that go through them.

Andrew Morton, is the one who applied rtc-spear patches till now. Added in cc.

--
viresh
Devendra Naga - June 20, 2012, 4:49 p.m.
Hi Viresh,

On Wed, Jun 20, 2012 at 8:14 PM, viresh kumar <viresh.linux@gmail.com> wrote:
> On Wed, Jun 20, 2012 at 3:39 PM, devendra.aaru <devendra.aaru@gmail.com> wrote:
>> On Wed, Jun 20, 2012 at 7:57 PM, Viresh Kumar <viresh.linux@gmail.com> wrote:
>>> Reviewed-by: Viresh Kumar <viresh.linux@gmail.com>
>>
>> Thanks, at last :-).
>>
>> Is there any tree through which it can reach torvalds?
>
> The way I would have found this information about any driver is by
> looking at its
> git-log and check via which path patches have been going till date. Maintainers
> normally adds there signed-off's to patches that go through them.
>
> Andrew Morton, is the one who applied rtc-spear patches till now. Added in cc.
>
Thanks a lot for the information.
> --
> viresh

Devendra.

Patch

diff --git a/drivers/rtc/rtc-spear.c b/drivers/rtc/rtc-spear.c
index 1f76320..e278547 100644
--- a/drivers/rtc/rtc-spear.c
+++ b/drivers/rtc/rtc-spear.c
@@ -458,12 +458,12 @@  static int __devexit spear_rtc_remove(struct platform_device *pdev)
 	clk_disable(config->clk);
 	clk_put(config->clk);
 	iounmap(config->ioaddr);
-	kfree(config);
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (res)
 		release_mem_region(res->start, resource_size(res));
 	platform_set_drvdata(pdev, NULL);
 	rtc_device_unregister(config->rtc);
+	kfree(config);
 
 	return 0;
 }