diff options
author | Marek Szyprowski <m.szyprowski@samsung.com> | 2011-04-14 06:17:44 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-04-19 15:07:34 -0400 |
commit | 13b140953ab4fd86e2065adfef892fe833986ffa (patch) | |
tree | 1474b2b818b6d6fe244075c712f6ce218b6490b8 /drivers/media | |
parent | ea42c8ecb2ff998b8f71e0a5f9d2748a65cb8f04 (diff) |
[media] media: vb2: correct queue initialization order
q->memory entry is initialized to late, so if allocation of memory buffers
fails, the buffers might not be freed correctly (q->memory is tested in
__vb2_free_mem, which can be called before setting q->memory).
Reported-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
CC: Pawel Osciak <pawel@osciak.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/videobuf2-core.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/media/video/videobuf2-core.c b/drivers/media/video/videobuf2-core.c index 09d792d2edfd..6ba1461d51ef 100644 --- a/drivers/media/video/videobuf2-core.c +++ b/drivers/media/video/videobuf2-core.c | |||
@@ -525,6 +525,7 @@ int vb2_reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req) | |||
525 | num_buffers = min_t(unsigned int, req->count, VIDEO_MAX_FRAME); | 525 | num_buffers = min_t(unsigned int, req->count, VIDEO_MAX_FRAME); |
526 | memset(plane_sizes, 0, sizeof(plane_sizes)); | 526 | memset(plane_sizes, 0, sizeof(plane_sizes)); |
527 | memset(q->alloc_ctx, 0, sizeof(q->alloc_ctx)); | 527 | memset(q->alloc_ctx, 0, sizeof(q->alloc_ctx)); |
528 | q->memory = req->memory; | ||
528 | 529 | ||
529 | /* | 530 | /* |
530 | * Ask the driver how many buffers and planes per buffer it requires. | 531 | * Ask the driver how many buffers and planes per buffer it requires. |
@@ -566,8 +567,6 @@ int vb2_reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req) | |||
566 | ret = num_buffers; | 567 | ret = num_buffers; |
567 | } | 568 | } |
568 | 569 | ||
569 | q->memory = req->memory; | ||
570 | |||
571 | /* | 570 | /* |
572 | * Return the number of successfully allocated buffers | 571 | * Return the number of successfully allocated buffers |
573 | * to the userspace. | 572 | * to the userspace. |