Patch "media: i2c: tda1997: Fix possible use-after-free in tda1997x_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: i2c: tda1997: Fix possible use-after-free in tda1997x_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-i2c-tda1997-fix-possible-use-after-free-in-tda.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 89c64c1debed2351a881502380b954b8d560e3d9
Author: Yang Yingliang <yangyingliang@xxxxxxxxxx>
Date:   Tue Apr 6 15:49:45 2021 +0200

    media: i2c: tda1997: Fix possible use-after-free in tda1997x_remove()
    
    [ Upstream commit 7f820ab5d4eebfe2d970d32a76ae496a6c286f0f ]
    
    This driver's remove path calls cancel_delayed_work(). However, that
    function does not wait until the work function finishes. This means
    that the callback function may still be running after the driver's
    remove function has finished, which would result in a use-after-free.
    
    Fix by calling cancel_delayed_work_sync(), which ensures that
    the work is properly cancelled, no longer running, and unable
    to re-schedule itself.
    
    Reported-by: Hulk Robot <hulkci@xxxxxxxxxx>
    Signed-off-by: Yang Yingliang <yangyingliang@xxxxxxxxxx>
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xxxxxxxxx>
    Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/media/i2c/tda1997x.c b/drivers/media/i2c/tda1997x.c
index a09bf0a39d05..89bb7e6dc7a4 100644
--- a/drivers/media/i2c/tda1997x.c
+++ b/drivers/media/i2c/tda1997x.c
@@ -2804,7 +2804,7 @@ static int tda1997x_remove(struct i2c_client *client)
 	media_entity_cleanup(&sd->entity);
 	v4l2_ctrl_handler_free(&state->hdl);
 	regulator_bulk_disable(TDA1997X_NUM_SUPPLIES, state->supplies);
-	cancel_delayed_work(&state->delayed_work_enable_hpd);
+	cancel_delayed_work_sync(&state->delayed_work_enable_hpd);
 	mutex_destroy(&state->page_lock);
 	mutex_destroy(&state->lock);
 



[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