[PATCH] media: cxusb: Initialize medion after checking intf

Edward Adam Davis
2025-05-13T23:09:57Z

dvb_usb_device_exit() is entered because the number of alternate setting
is less than 2. Check the USB interface in advance to avoid unnecessary
dvb device initialization and exit.

Reported-by: syzbot+0dcc341ee61fc9e4032f@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=0dcc341ee61fc9e4032f
Tested-by: syzbot+0dcc341ee61fc9e4032f@syzkaller.appspotmail.com
Signed-off-by: Edward Adam Davis <eadavis@qq.com>
---
drivers/media/usb/dvb-usb/cxusb.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/media/usb/dvb-usb/cxusb.c b/drivers/media/usb/dvb-usb/cxusb.c
index f44529b40989..df86ae7106c1 100644
--- a/drivers/media/usb/dvb-usb/cxusb.c
+++ b/drivers/media/usb/dvb-usb/cxusb.c
@@ -1601,13 +1601,9 @@ static int cxusb_probe(struct usb_interface *intf,
int ret;

/* Medion 95700 */
- if (!dvb_usb_device_init(intf, &cxusb_medion_properties,
+ if (cxusb_medion_check_intf(intf) &&
+ !dvb_usb_device_init(intf, &cxusb_medion_properties,
THIS_MODULE, &dvbdev, adapter_nr)) {
- if (!cxusb_medion_check_intf(intf)) {
- ret = -ENODEV;
- goto ret_uninit;
- }
-
_cxusb_power_ctrl(dvbdev, 1);
ret = cxusb_medion_set_mode(dvbdev, false);
if (ret)
--
2.43.0