lkml.org 
[lkml]   [2012]   [Jun]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] drivers/w1: free the w1_master at w1_free_dev and return a correct return value
On Sun, Jun 17, 2012 at 09:47:59PM +0530, Devendra Naga wrote:
> the w1_master pointer is allced at the w1_alloc_master and is not freed when called with
> w1_remove_master.
>
> when w1_alloc_dev fails the return should be -ENODEV as it does
> device_register, and that is the last case where that function
> will fail.
>
> Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
> Acked-by: Evgeniy Polyakov <zbr@ioremap.net>
> ---
> drivers/w1/w1_int.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/w1/w1_int.c b/drivers/w1/w1_int.c
> index 6828835..a3cf27d 100644
> --- a/drivers/w1/w1_int.c
> +++ b/drivers/w1/w1_int.c
> @@ -100,6 +100,7 @@ static struct w1_master * w1_alloc_dev(u32 id, int slave_count, int slave_ttl,
> static void w1_free_dev(struct w1_master *dev)
> {
> device_unregister(&dev->dev);
> + kfree(dev);

No, this is wrong, the memory will be freed in w1_master_release(),
right? It is not freed here, sorry, this patch is incorrect.

greg k-h


\
 
 \ /
  Last update: 2012-06-21 02:21    [W:0.104 / U:5.892 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site