This is a note to let you know that I've just added the patch titled

    media: vmalloc_sg: off by one in error handling

to the 3.17-stable tree which can be found at:
    
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     media-vmalloc_sg-off-by-one-in-error-handling.patch
and it can be found in the queue-3.17 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.


>From 23d3090f8b44ab42162e99e8584445bc25b8922f Mon Sep 17 00:00:00 2001
From: Dan Carpenter <[email protected]>
Date: Tue, 5 Aug 2014 05:11:13 -0300
Subject: media: vmalloc_sg: off by one in error handling

From: Dan Carpenter <[email protected]>

commit 23d3090f8b44ab42162e99e8584445bc25b8922f upstream.

The "i--" needs to happen at the start of the loop or it will try to
release something bogus (probably it will crash) and it won't release
the first ->vaddr_page[].

Fixes: 7b4eeed174b7 ('[media] vmalloc_sg: make sure all pages in vmalloc area 
are really DMA-ready')

Signed-off-by: Dan Carpenter <[email protected]>
Signed-off-by: Hans Verkuil <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
 drivers/media/v4l2-core/videobuf-dma-sg.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

--- a/drivers/media/v4l2-core/videobuf-dma-sg.c
+++ b/drivers/media/v4l2-core/videobuf-dma-sg.c
@@ -253,9 +253,11 @@ int videobuf_dma_init_kernel(struct vide
        return 0;
 out_free_pages:
        while (i > 0) {
-               void *addr = page_address(dma->vaddr_pages[i]);
-               dma_free_coherent(dma->dev, PAGE_SIZE, addr, dma->dma_addr[i]);
+               void *addr;
+
                i--;
+               addr = page_address(dma->vaddr_pages[i]);
+               dma_free_coherent(dma->dev, PAGE_SIZE, addr, dma->dma_addr[i]);
        }
        kfree(dma->dma_addr);
        dma->dma_addr = NULL;


Patches currently in stable-queue which might be from [email protected] 
are

queue-3.17/media-vmalloc_sg-off-by-one-in-error-handling.patch
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to