Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0b29669c065f60501e7289e1950fa2a618962358
Commit:     0b29669c065f60501e7289e1950fa2a618962358
Parent:     843b1378c2ab47ab1ed9cb471938e0f0ec839fcd
Author:     Brandon Philips <[EMAIL PROTECTED]>
AuthorDate: Sat Dec 8 23:05:53 2007 -0300
Committer:  Mauro Carvalho Chehab <[EMAIL PROTECTED]>
CommitDate: Tue Dec 11 18:08:22 2007 -0200

    V4L/DVB (6751): V4L: Memory leak!  Fix count in videobuf-vmalloc mmap
    
    This is pretty serious bug.  map->count is never initialized after the
    call to kmalloc making the count start at some random trash value.  The
    end result is leaking videobufs.
    
    Also, fix up the debug statements to print unsigned values.
    
    Pushed to http://ifup.org/hg/v4l-dvb too
    
    Signed-off-by: Brandon Philips <[EMAIL PROTECTED]>
    Signed-off-by: Mauro Carvalho Chehab <[EMAIL PROTECTED]>
---
 drivers/media/video/videobuf-vmalloc.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/media/video/videobuf-vmalloc.c 
b/drivers/media/video/videobuf-vmalloc.c
index cd74341..e012594 100644
--- a/drivers/media/video/videobuf-vmalloc.c
+++ b/drivers/media/video/videobuf-vmalloc.c
@@ -51,7 +51,7 @@ videobuf_vm_open(struct vm_area_struct *vma)
 {
        struct videobuf_mapping *map = vma->vm_private_data;
 
-       dprintk(2,"vm_open %p [count=%d,vma=%08lx-%08lx]\n",map,
+       dprintk(2,"vm_open %p [count=%u,vma=%08lx-%08lx]\n",map,
                map->count,vma->vm_start,vma->vm_end);
 
        map->count++;
@@ -64,7 +64,7 @@ videobuf_vm_close(struct vm_area_struct *vma)
        struct videobuf_queue *q = map->q;
        int i;
 
-       dprintk(2,"vm_close %p [count=%d,vma=%08lx-%08lx]\n",map,
+       dprintk(2,"vm_close %p [count=%u,vma=%08lx-%08lx]\n",map,
                map->count,vma->vm_start,vma->vm_end);
 
        map->count--;
@@ -221,7 +221,7 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q,
        }
 
        /* create mapping + update buffer list */
-       map = q->bufs[first]->map = kmalloc(sizeof(struct 
videobuf_mapping),GFP_KERNEL);
+       map = q->bufs[first]->map = kzalloc(sizeof(struct 
videobuf_mapping),GFP_KERNEL);
        if (NULL == map)
                return -ENOMEM;
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to