| 38e18579 | 06-Nov-2023 |
Zheng Wang <[email protected]> |
media: mtk-jpeg: Fix timeout schedule error in mtk_jpegdec_worker.
In mtk_jpegdec_worker, if error occurs in mtk_jpeg_set_dec_dst, it will start the timeout worker and invoke v4l2_m2m_job_finish at
media: mtk-jpeg: Fix timeout schedule error in mtk_jpegdec_worker.
In mtk_jpegdec_worker, if error occurs in mtk_jpeg_set_dec_dst, it will start the timeout worker and invoke v4l2_m2m_job_finish at the same time. This will break the logic of design for there should be only one function to call v4l2_m2m_job_finish. But now the timeout handler and mtk_jpegdec_worker will both invoke it.
Fix it by start the worker only if mtk_jpeg_set_dec_dst successfully finished.
Fixes: da4ede4b7fd6 ("media: mtk-jpeg: move data/code inside CONFIG_OF blocks") Signed-off-by: Zheng Wang <[email protected]> Signed-off-by: Dmitry Osipenko <[email protected]> Cc: [email protected] Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
show more ...
|
| 206c857d | 06-Nov-2023 |
Zheng Wang <[email protected]> |
media: mtk-jpeg: Fix use after free bug due to error path handling in mtk_jpeg_dec_device_run
In mtk_jpeg_probe, &jpeg->job_timeout_work is bound with mtk_jpeg_job_timeout_work.
In mtk_jpeg_dec_dev
media: mtk-jpeg: Fix use after free bug due to error path handling in mtk_jpeg_dec_device_run
In mtk_jpeg_probe, &jpeg->job_timeout_work is bound with mtk_jpeg_job_timeout_work.
In mtk_jpeg_dec_device_run, if error happens in mtk_jpeg_set_dec_dst, it will finally start the worker while mark the job as finished by invoking v4l2_m2m_job_finish.
There are two methods to trigger the bug. If we remove the module, it which will call mtk_jpeg_remove to make cleanup. The possible sequence is as follows, which will cause a use-after-free bug.
CPU0 CPU1 mtk_jpeg_dec_... | start worker | |mtk_jpeg_job_timeout_work mtk_jpeg_remove | v4l2_m2m_release | kfree(m2m_dev); | | | v4l2_m2m_get_curr_priv | m2m_dev->curr_ctx //use
If we close the file descriptor, which will call mtk_jpeg_release, it will have a similar sequence.
Fix this bug by starting timeout worker only if started jpegdec worker successfully. Then v4l2_m2m_job_finish will only be called in either mtk_jpeg_job_timeout_work or mtk_jpeg_dec_device_run.
Fixes: b2f0d2724ba4 ("[media] vcodec: mediatek: Add Mediatek JPEG Decoder Driver") Signed-off-by: Zheng Wang <[email protected]> Signed-off-by: Dmitry Osipenko <[email protected]> Cc: [email protected] Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
show more ...
|
| 8329d0c7 | 10-Jul-2023 |
Chen-Yu Tsai <[email protected]> |
media: mtk-jpeg: Set platform driver data earlier
In the multi-core JPEG encoder/decoder setup, the driver for the individual cores references the parent device's platform driver data. However, in t
media: mtk-jpeg: Set platform driver data earlier
In the multi-core JPEG encoder/decoder setup, the driver for the individual cores references the parent device's platform driver data. However, in the parent driver, this is only set at the end of the probe function, way later than devm_of_platform_populate(), which triggers the probe of the cores. This causes a kernel splat in the sub-device probe function.
Move platform_set_drvdata() to before devm_of_platform_populate() to fix this.
Fixes: 934e8bccac95 ("mtk-jpegenc: support jpegenc multi-hardware") Signed-off-by: Chen-Yu Tsai <[email protected]> Reviewed-by: AngeloGioacchino Del Regno <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
show more ...
|
| 72a6127e | 23-May-2023 |
Geert Uytterhoeven <[email protected]> |
media: Add common header file with JPEG marker definitions
When compile-testing on mips/RB532 with W=1:
arch/mips/include/asm/mach-rc32434/rb.h:13: note: this is the location of the previous de
media: Add common header file with JPEG marker definitions
When compile-testing on mips/RB532 with W=1:
arch/mips/include/asm/mach-rc32434/rb.h:13: note: this is the location of the previous definition 13 | #define RST (1 << 15) | drivers/media/platform/mediatek/jpeg/mtk_jpeg_dec_parse.c:15: warning: "RST" redefined 15 | #define RST 0xd0 | drivers/media/platform/renesas/rcar_jpu.c:77: warning: "RST" redefined 77 | #define RST 0xd0 |
"RST" is indeed a name too short to be conflict-free.
Fix this by creating a common <media/jpeg.h> header file, containing definitions for all JPEG markers used, prefixed by "JPEG_MARKER_", based on the existing private definitions in the Samsung S5P JPEG driver, and convert all affected drivers.
Reported-by: kernel test robot <[email protected]> Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Signed-off-by: Geert Uytterhoeven <[email protected]> Acked-by: Andrzej Pietrasiewicz <[email protected]> (s5p-jpeg) Reviewed-by: Laurent Pinchart <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
show more ...
|
| 6a7a883f | 10-Mar-2023 |
kyrie wu <[email protected]> |
media: mtk-jpeg: Remove some unnecessary variables
remove is_jpgenc_multihw, is_jpgdec_multihw, and unnecessary initialization.
Signed-off-by: kyrie wu <[email protected]> Signed-off-by: irui w
media: mtk-jpeg: Remove some unnecessary variables
remove is_jpgenc_multihw, is_jpgdec_multihw, and unnecessary initialization.
Signed-off-by: kyrie wu <[email protected]> Signed-off-by: irui wang <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
show more ...
|
| d40e9527 | 10-Mar-2023 |
kyrie wu <[email protected]> |
media: mtk-jpeg: reconstructs the initialization mode of worker
exclude is_jpgenc_multihw or is_jpgdec_multihw for judgment, and re-initialize jpeg worker.
Signed-off-by: kyrie wu <kyrie.wu@mediate
media: mtk-jpeg: reconstructs the initialization mode of worker
exclude is_jpgenc_multihw or is_jpgdec_multihw for judgment, and re-initialize jpeg worker.
Signed-off-by: kyrie wu <[email protected]> Signed-off-by: irui wang <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
show more ...
|
| 86379bd9 | 10-Mar-2023 |
kyrie wu <[email protected]> |
media: mtk-jpeg: Fixes jpeg enc&dec worker sw flow
1. Move removing buffer after sw setting and before hw setting in enc&dec worker to prevents the operation of removing the buffer twice if the sw s
media: mtk-jpeg: Fixes jpeg enc&dec worker sw flow
1. Move removing buffer after sw setting and before hw setting in enc&dec worker to prevents the operation of removing the buffer twice if the sw setting fails. 2. Remove the redundant operation of queue work in the jpegenc irq handler because the jpegenc worker has called v4l2_m2m_job_finish to do it.
Fixes: 5fb1c2361e56 ("mtk-jpegenc: add jpeg encode worker interface") Fixes: dedc21500334 ("media: mtk-jpegdec: add jpeg decode worker interface") Signed-off-by: kyrie wu <[email protected]> Signed-off-by: irui wang <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
show more ...
|
| 9ceca28e | 10-Mar-2023 |
kyrie wu <[email protected]> |
media: mtk-jpeg: add jpeg single core initial function
add single core initial function to init reg_base, irq and clk.
Signed-off-by: kyrie wu <[email protected]> Signed-off-by: irui wang <irui
media: mtk-jpeg: add jpeg single core initial function
add single core initial function to init reg_base, irq and clk.
Signed-off-by: kyrie wu <[email protected]> Signed-off-by: irui wang <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
show more ...
|