[3/8] drivers/media/video/hdpvr: introduce missing kfree

Message ID 20090916111325.GA14900@aniel.lan (mailing list archive)
State Superseded, archived
Headers

Commit Message

Janne Grunau Sept. 16, 2009, 11:13 a.m. UTC
  On Fri, Sep 11, 2009 at 06:21:35PM +0200, Julia Lawall wrote:
> 
> Error handling code following a kzalloc should free the allocated data.

Thanks for the report. I'll commit a different patch which adds the buffer
to the buffer list as soon it is allocated. The hdpvr_free_buffers() in the
error handling code will clean it up then. See below:

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
  

Comments

Mauro Carvalho Chehab Feb. 2, 2010, 3:19 p.m. UTC | #1
Hi Janne,

Janne Grunau wrote:
> On Fri, Sep 11, 2009 at 06:21:35PM +0200, Julia Lawall wrote:
>> Error handling code following a kzalloc should free the allocated data.
> 
> Thanks for the report. I'll commit a different patch which adds the buffer
> to the buffer list as soon it is allocated. The hdpvr_free_buffers() in the
> error handling code will clean it up then. See below:

Any news about this subject? The current upstream code still misses the change bellow

> 
> diff --git a/linux/drivers/media/video/hdpvr/hdpvr-video.c b/linux/drivers/media/video/hdpvr/hdpvr-video.c
> --- a/linux/drivers/media/video/hdpvr/hdpvr-video.c
> +++ b/linux/drivers/media/video/hdpvr/hdpvr-video.c
> @@ -134,6 +134,8 @@
>                         v4l2_err(&dev->v4l2_dev, "cannot allocate buffer\n");
>                         goto exit;
>                 }
> +               list_add_tail(&buf->buff_list, &dev->free_buff_list);
> +
>                 buf->dev = dev;
> 
>                 urb = usb_alloc_urb(0, GFP_KERNEL);
> @@ -158,7 +160,6 @@
>                                   hdpvr_read_bulk_callback, buf);
> 
>                 buf->status = BUFSTAT_AVAILABLE;
> -               list_add_tail(&buf->buff_list, &dev->free_buff_list);
>         }
>         return 0;
>  exit:
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
  
Janne Grunau Feb. 3, 2010, 2:12 p.m. UTC | #2
Hej, 

On Tue, Feb 02, 2010 at 01:19:15PM -0200, Mauro Carvalho Chehab wrote:
> 
> Janne Grunau wrote:
> > On Fri, Sep 11, 2009 at 06:21:35PM +0200, Julia Lawall wrote:
> >> Error handling code following a kzalloc should free the allocated data.
> > 
> > Thanks for the report. I'll commit a different patch which adds the buffer
> > to the buffer list as soon it is allocated. The hdpvr_free_buffers() in the
> > error handling code will clean it up then. See below:
> 
> Any news about this subject? The current upstream code still misses the change bellow

it was fixed differently in cd0e280f

kind regards,
Janne
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
  
Mauro Carvalho Chehab Feb. 3, 2010, 2:28 p.m. UTC | #3
Janne Grunau wrote:
> Hej, 
> 
> On Tue, Feb 02, 2010 at 01:19:15PM -0200, Mauro Carvalho Chehab wrote:
>> Janne Grunau wrote:
>>> On Fri, Sep 11, 2009 at 06:21:35PM +0200, Julia Lawall wrote:
>>>> Error handling code following a kzalloc should free the allocated data.
>>> Thanks for the report. I'll commit a different patch which adds the buffer
>>> to the buffer list as soon it is allocated. The hdpvr_free_buffers() in the
>>> error handling code will clean it up then. See below:
>> Any news about this subject? The current upstream code still misses the change bellow
> 
> it was fixed differently in cd0e280f

Thanks! I'm removing it from my queue :)

Now, the only hdpvr patch is this one:

hdpvr-video: cleanup signedness                                         http://patchwork.kernel.org/patch/74902


Cheers,
Mauro
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
  

Patch

diff --git a/linux/drivers/media/video/hdpvr/hdpvr-video.c b/linux/drivers/media/video/hdpvr/hdpvr-video.c
--- a/linux/drivers/media/video/hdpvr/hdpvr-video.c
+++ b/linux/drivers/media/video/hdpvr/hdpvr-video.c
@@ -134,6 +134,8 @@ 
                        v4l2_err(&dev->v4l2_dev, "cannot allocate buffer\n");
                        goto exit;
                }
+               list_add_tail(&buf->buff_list, &dev->free_buff_list);
+
                buf->dev = dev;

                urb = usb_alloc_urb(0, GFP_KERNEL);
@@ -158,7 +160,6 @@ 
                                  hdpvr_read_bulk_callback, buf);

                buf->status = BUFSTAT_AVAILABLE;
-               list_add_tail(&buf->buff_list, &dev->free_buff_list);
        }
        return 0;
 exit: