mirror of
https://github.com/torvalds/linux.git
synced 2026-06-02 11:33:28 +02:00
media: rockchip: rga: Fix possible ERR_PTR dereference in rga_buf_init()
rga_get_frame() can return ERR_PTR(-EINVAL) when buffer type is
unsupported or invalid. rga_buf_init() does not check the return value
and unconditionally dereferences the pointer when accessing f->size.
Add proper ERR_PTR checking and return the error to prevent
dereferencing an invalid pointer.
Fixes: 6040702ade ("media: rockchip: rga: allocate DMA descriptors per buffer")
Cc: stable@vger.kernel.org
Signed-off-by: Alper Ak <alperyasinak1@gmail.com>
Reviewed-by: Michael Tretter <m.tretter@pengutronix.de>
Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
This commit is contained in:
parent
5633ec763a
commit
81f8e0e6a2
|
|
@ -80,6 +80,9 @@ static int rga_buf_init(struct vb2_buffer *vb)
|
|||
struct rga_frame *f = rga_get_frame(ctx, vb->vb2_queue->type);
|
||||
size_t n_desc = 0;
|
||||
|
||||
if (IS_ERR(f))
|
||||
return PTR_ERR(f);
|
||||
|
||||
n_desc = DIV_ROUND_UP(f->size, PAGE_SIZE);
|
||||
|
||||
rbuf->n_desc = n_desc;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user