Patch "media: pvrusb2: fix use after free on context disconnection" has been added to the 5.15-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: pvrusb2: fix use after free on context disconnection

to the 5.15-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-pvrusb2-fix-use-after-free-on-context-disconne.patch
and it can be found in the queue-5.15 subdirectory.

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



commit 627aedd7a9ae405410e50df3cbe843b463d4bcdd
Author: Ricardo B. Marliere <ricardo@xxxxxxxxxxxx>
Date:   Fri Oct 13 01:09:12 2023 +0200

    media: pvrusb2: fix use after free on context disconnection
    
    [ Upstream commit ded85b0c0edd8f45fec88783d7555a5b982449c1 ]
    
    Upon module load, a kthread is created targeting the
    pvr2_context_thread_func function, which may call pvr2_context_destroy
    and thus call kfree() on the context object. However, that might happen
    before the usb hub_event handler is able to notify the driver. This
    patch adds a sanity check before the invalid read reported by syzbot,
    within the context disconnection call stack.
    
    Reported-and-tested-by: syzbot+621409285c4156a009b3@xxxxxxxxxxxxxxxxxxxxxxxxx
    Closes: https://lore.kernel.org/all/000000000000a02a4205fff8eb92@xxxxxxxxxx/
    
    Fixes: e5be15c63804 ("V4L/DVB (7711): pvrusb2: Fix race on module unload")
    Signed-off-by: Ricardo B. Marliere <ricardo@xxxxxxxxxxxx>
    Acked-by: Mike Isely <isely@xxxxxxxxx>
    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/media/usb/pvrusb2/pvrusb2-context.c b/drivers/media/usb/pvrusb2/pvrusb2-context.c
index 14170a5d72b3..1764674de98b 100644
--- a/drivers/media/usb/pvrusb2/pvrusb2-context.c
+++ b/drivers/media/usb/pvrusb2/pvrusb2-context.c
@@ -268,7 +268,8 @@ void pvr2_context_disconnect(struct pvr2_context *mp)
 {
 	pvr2_hdw_disconnect(mp->hdw);
 	mp->disconnect_flag = !0;
-	pvr2_context_notify(mp);
+	if (!pvr2_context_shutok())
+		pvr2_context_notify(mp);
 }
 
 




[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