Patch "media: imon: fix access to invalid resource for the second interface" has been added to the 6.5-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: imon: fix access to invalid resource for the second interface

to the 6.5-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-imon-fix-access-to-invalid-resource-for-the-se.patch
and it can be found in the queue-6.5 subdirectory.

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



commit 1f4b3d26b39a9a18cea64b8a2e2fab818e5beb06
Author: Takashi Iwai <tiwai@xxxxxxx>
Date:   Fri Sep 22 14:38:07 2023 +0200

    media: imon: fix access to invalid resource for the second interface
    
    [ Upstream commit a1766a4fd83befa0b34d932d532e7ebb7fab1fa7 ]
    
    imon driver probes two USB interfaces, and at the probe of the second
    interface, the driver assumes blindly that the first interface got
    bound with the same imon driver.  It's usually true, but it's still
    possible that the first interface is bound with another driver via a
    malformed descriptor.  Then it may lead to a memory corruption, as
    spotted by syzkaller; imon driver accesses the data from drvdata as
    struct imon_context object although it's a completely different one
    that was assigned by another driver.
    
    This patch adds a sanity check -- whether the first interface is
    really bound with the imon driver or not -- for avoiding the problem
    above at the probe time.
    
    Reported-by: syzbot+59875ffef5cb9c9b29e9@xxxxxxxxxxxxxxxxxxxxxxxxx
    Closes: https://lore.kernel.org/all/000000000000a838aa0603cc74d6@xxxxxxxxxx/
    Tested-by: Ricardo B. Marliere <ricardo@xxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20230922005152.163640-1-ricardo@xxxxxxxxxxxx
    Signed-off-by: Takashi Iwai <tiwai@xxxxxxx>
    Signed-off-by: Sean Young <sean@xxxxxxxx>
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c
index 74546f7e34691..5719dda6e0f0e 100644
--- a/drivers/media/rc/imon.c
+++ b/drivers/media/rc/imon.c
@@ -2427,6 +2427,12 @@ static int imon_probe(struct usb_interface *interface,
 		goto fail;
 	}
 
+	if (first_if->dev.driver != interface->dev.driver) {
+		dev_err(&interface->dev, "inconsistent driver matching\n");
+		ret = -EINVAL;
+		goto fail;
+	}
+
 	if (ifnum == 0) {
 		ictx = imon_init_intf0(interface, id);
 		if (!ictx) {



[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