All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Videobuf2 hot fixes
@ 2011-01-28 12:56 Marek Szyprowski
  2011-01-28 12:56 ` [PATCH 1/2] v4l2: vb2: fix queue reallocation and REQBUFS(0) case Marek Szyprowski
  2011-01-28 12:56 ` [PATCH 2/2] v4l2: vb2-dma-sg: fix memory leak Marek Szyprowski
  0 siblings, 2 replies; 3+ messages in thread
From: Marek Szyprowski @ 2011-01-28 12:56 UTC (permalink / raw)
  To: linux-media; +Cc: m.szyprowski, pawel, kyungmin.park

Hello!

This is a small set of bugfixes for videobuf2 framework. It looks that
even review done by 3 other developers can miss some minor bugs. I hope
they can be applied to v2.6.38-rcX kernel series once vb2 finally gets
into Linus tree.

Best regards
--
Marek Szyprowski
Samsung Poland R&D Center


Patch summary:

Andrzej Pietrasiewicz (1):
  v4l2: vb2-dma-sg: fix memory leak

Marek Szyprowski (1):
  v4l2: vb2: fix queue reallocation and REQBUFS(0) case

 drivers/media/video/videobuf2-core.c   |    9 ++++++++-
 drivers/media/video/videobuf2-dma-sg.c |    2 ++
 2 files changed, 10 insertions(+), 1 deletions(-)

-- 
1.7.1.569.g6f426


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] v4l2: vb2: fix queue reallocation and REQBUFS(0) case
  2011-01-28 12:56 [PATCH 0/2] Videobuf2 hot fixes Marek Szyprowski
@ 2011-01-28 12:56 ` Marek Szyprowski
  2011-01-28 12:56 ` [PATCH 2/2] v4l2: vb2-dma-sg: fix memory leak Marek Szyprowski
  1 sibling, 0 replies; 3+ messages in thread
From: Marek Szyprowski @ 2011-01-28 12:56 UTC (permalink / raw)
  To: linux-media; +Cc: m.szyprowski, pawel, kyungmin.park

This patch fixes 2 minor bugs in videobuf2 core:
1. Queue should be reallocated if one change the memory access
method without changing the number of buffers.
2. In case of REQBUFS(0), the request should not be passed to the
driver.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 drivers/media/video/videobuf2-core.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/drivers/media/video/videobuf2-core.c b/drivers/media/video/videobuf2-core.c
index cc7ab0a..2f724ed 100644
--- a/drivers/media/video/videobuf2-core.c
+++ b/drivers/media/video/videobuf2-core.c
@@ -488,7 +488,7 @@ int vb2_reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req)
 		return -EINVAL;
 	}
 
-	if (req->count == 0 || q->num_buffers != 0) {
+	if (req->count == 0 || q->num_buffers != 0 || q->memory != req->memory) {
 		/*
 		 * We already have buffers allocated, so first check if they
 		 * are not in use and can be freed.
@@ -501,6 +501,13 @@ int vb2_reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req)
 		ret = __vb2_queue_free(q);
 		if (ret != 0)
 			return ret;
+
+		/*
+		 * In case of REQBUFS(0) return immedietely without calling
+		 * driver's queue_setup() callback and allocating resources.
+		 */
+		if (req->count == 0)
+			return 0;
 	}
 
 	/*
-- 
1.7.1.569.g6f426


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] v4l2: vb2-dma-sg: fix memory leak
  2011-01-28 12:56 [PATCH 0/2] Videobuf2 hot fixes Marek Szyprowski
  2011-01-28 12:56 ` [PATCH 1/2] v4l2: vb2: fix queue reallocation and REQBUFS(0) case Marek Szyprowski
@ 2011-01-28 12:56 ` Marek Szyprowski
  1 sibling, 0 replies; 3+ messages in thread
From: Marek Szyprowski @ 2011-01-28 12:56 UTC (permalink / raw)
  To: linux-media; +Cc: m.szyprowski, pawel, kyungmin.park, Andrzej Pietrasiewicz

From: Andrzej Pietrasiewicz <andrzej.p@samsung.com>

This patch fixes two minor memory leaks in videobuf2-dma-sg module. They
might happen only in case some other operations (like memory allocation)
failed.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 drivers/media/video/videobuf2-dma-sg.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/videobuf2-dma-sg.c b/drivers/media/video/videobuf2-dma-sg.c
index 20b5c5d..d5311ff 100644
--- a/drivers/media/video/videobuf2-dma-sg.c
+++ b/drivers/media/video/videobuf2-dma-sg.c
@@ -88,6 +88,7 @@ static void *vb2_dma_sg_alloc(void *alloc_ctx, unsigned long size)
 fail_pages_alloc:
 	while (--i >= 0)
 		__free_page(buf->pages[i]);
+	kfree(buf->pages);
 
 fail_pages_array_alloc:
 	vfree(buf->sg_desc.sglist);
@@ -176,6 +177,7 @@ userptr_fail_get_user_pages:
 	       num_pages_from_user, buf->sg_desc.num_pages);
 	while (--num_pages_from_user >= 0)
 		put_page(buf->pages[num_pages_from_user]);
+	kfree(buf->pages);
 
 userptr_fail_pages_array_alloc:
 	vfree(buf->sg_desc.sglist);
-- 
1.7.1.569.g6f426


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-01-28 12:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-28 12:56 [PATCH 0/2] Videobuf2 hot fixes Marek Szyprowski
2011-01-28 12:56 ` [PATCH 1/2] v4l2: vb2: fix queue reallocation and REQBUFS(0) case Marek Szyprowski
2011-01-28 12:56 ` [PATCH 2/2] v4l2: vb2-dma-sg: fix memory leak Marek Szyprowski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.