]> git.baikalelectronics.ru Git - kernel.git/commit
media: rockchip/rga: fix error handling in probe
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 13 Jul 2021 09:24:10 +0000 (11:24 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Thu, 22 Jul 2021 12:01:55 +0000 (14:01 +0200)
commite88fb298c895b30c8d2bbec04e52d59670b28a9f
tree0214fecec9fd14ee0052cfa5b4304a3d36b75a42
parent921622d93ee12ed00729a9e86f2e42f713162d5d
media: rockchip/rga: fix error handling in probe

There are a few bugs in this code.  1)  No checks for whether
dma_alloc_attrs() or __get_free_pages() failed.  2)  If
video_register_device() fails it doesn't clean up the dma attrs or the
free pages.  3)  The video_device_release() function frees "vfd" which
leads to a use after free on the next line.  The call to
video_unregister_device() is not required so I have just removed that.

Fixes: 1a0fe9d5c6c4 ("[media] rockchip/rga: v4l2 m2m support")
Reported-by: Dongliang Mu <mudongliangabcd@gmail.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/platform/rockchip/rga/rga.c