media: venus: fix use after free in vdec_close
authorDikshita Agarwal <quic_dikshita@quicinc.com>
Thu, 9 May 2024 05:14:29 +0000 (10:44 +0530)
committerHans Verkuil <hverkuil-cisco@xs4all.nl>
Sun, 30 Jun 2024 09:22:44 +0000 (11:22 +0200)
commita0157b5aa34eb43ec4c5510f9c260bbb03be937e
tree82a3013814ce2d56acec91510255096f51aad35f
parent193b3dac29a441fb72d2bbc3b4c4ebf2961e3c27
media: venus: fix use after free in vdec_close

There appears to be a possible use after free with vdec_close().
The firmware will add buffer release work to the work queue through
HFI callbacks as a normal part of decoding. Randomly closing the
decoder device from userspace during normal decoding can incur
a read after free for inst.

Fix it by cancelling the work in vdec_close.

Cc: stable@vger.kernel.org
Fixes: af2c3834c8ca ("[media] media: venus: adding core part and helper functions")
Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
Acked-by: Vikash Garodia <quic_vgarodia@quicinc.com>
Signed-off-by: Stanimir Varbanov <stanimir.k.varbanov@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
drivers/media/platform/qcom/venus/vdec.c