Patch "media: rkvdec: fix use after free bug in rkvdec_remove" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    media: rkvdec: fix use after free bug in rkvdec_remove

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     media-rkvdec-fix-use-after-free-bug-in-rkvdec_remove.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 42255cb267cfa9ee45eb103eaa51838f63011ee9
Author: Zheng Wang <zyytlz.wz@xxxxxxx>
Date:   Mon Mar 13 16:42:20 2023 +0000

    media: rkvdec: fix use after free bug in rkvdec_remove
    
    [ Upstream commit 3228cec23b8b29215e18090c6ba635840190993d ]
    
    In rkvdec_probe, rkvdec->watchdog_work is bound with
    rkvdec_watchdog_func. Then rkvdec_vp9_run may
    be called to start the work.
    
    If we remove the module which will call rkvdec_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 rkvdec_remove.
    
    CPU0                  CPU1
    
                        |rkvdec_watchdog_func
    rkvdec_remove       |
     rkvdec_v4l2_cleanup|
      v4l2_m2m_release  |
        kfree(m2m_dev); |
                        |
                        | v4l2_m2m_get_curr_priv
                        |   m2m_dev->curr_ctx //use
    
    Fixes: cd33c830448b ("media: rkvdec: Add the rkvdec driver")
    Signed-off-by: Zheng Wang <zyytlz.wz@xxxxxxx>
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xxxxxxxxx>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c
index e384ea8d72801..f6a29a7078625 100644
--- a/drivers/staging/media/rkvdec/rkvdec.c
+++ b/drivers/staging/media/rkvdec/rkvdec.c
@@ -1077,6 +1077,8 @@ static int rkvdec_remove(struct platform_device *pdev)
 {
 	struct rkvdec_dev *rkvdec = platform_get_drvdata(pdev);
 
+	cancel_delayed_work_sync(&rkvdec->watchdog_work);
+
 	rkvdec_v4l2_cleanup(rkvdec);
 	pm_runtime_disable(&pdev->dev);
 	pm_runtime_dont_use_autosuspend(&pdev->dev);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux