diff options
author | Zheng Wang <zyytlz.wz@163.com> | 2023-07-07 17:24:14 +0800 |
---|---|---|
committer | Hans Verkuil <hverkuil-cisco@xs4all.nl> | 2023-07-25 09:31:48 +0200 |
commit | c677d7ae83141d390d1253abebafa49c962afb52 (patch) | |
tree | e60ef4e62763e4127d6c9070bb3a3c7a10748fa9 /scripts/Makefile.lib | |
parent | b3b4c9d3cb3bf8725a3ded26f7042b1a37f25333 (diff) | |
download | linux-stable-c677d7ae83141d390d1253abebafa49c962afb52.tar.gz linux-stable-c677d7ae83141d390d1253abebafa49c962afb52.tar.bz2 linux-stable-c677d7ae83141d390d1253abebafa49c962afb52.zip |
media: mtk-jpeg: Fix use after free bug due to uncanceled work
In mtk_jpeg_probe, &jpeg->job_timeout_work is bound with
mtk_jpeg_job_timeout_work. Then mtk_jpeg_dec_device_run
and mtk_jpeg_enc_device_run may be called to start the
work.
If we remove the module which will call mtk_jpeg_remove
to make cleanup, there may be a unfinished work. The
possible sequence is as follows, which will cause a
typical UAF bug.
Fix it by canceling the work before cleanup in the mtk_jpeg_remove
CPU0 CPU1
|mtk_jpeg_job_timeout_work
mtk_jpeg_remove |
v4l2_m2m_release |
kfree(m2m_dev); |
|
| v4l2_m2m_get_curr_priv
| m2m_dev->curr_ctx //use
Fixes: b2f0d2724ba4 ("[media] vcodec: mediatek: Add Mediatek JPEG Decoder Driver")
Signed-off-by: Zheng Wang <zyytlz.wz@163.com>
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>
Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Diffstat (limited to 'scripts/Makefile.lib')
0 files changed, 0 insertions, 0 deletions