1 From 3864d33943b4a76c6e64616280e98d2410b1190f Mon Sep 17 00:00:00 2001
2 From: Oliver Neukum <oneukum@suse.com>
3 Date: Thu, 9 May 2019 11:30:58 +0200
4 Subject: USB: rio500: refuse more than one device at a time
6 From: Oliver Neukum <oneukum@suse.com>
8 commit 3864d33943b4a76c6e64616280e98d2410b1190f upstream.
10 This driver is using a global variable. It cannot handle more than
11 one device at a time. The issue has been existing since the dawn
14 Signed-off-by: Oliver Neukum <oneukum@suse.com>
15 Reported-by: syzbot+35f04d136fc975a70da4@syzkaller.appspotmail.com
16 Cc: stable <stable@vger.kernel.org>
17 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 drivers/usb/misc/rio500.c | 24 ++++++++++++++++++------
21 1 file changed, 18 insertions(+), 6 deletions(-)
23 --- a/drivers/usb/misc/rio500.c
24 +++ b/drivers/usb/misc/rio500.c
25 @@ -447,15 +447,23 @@ static int probe_rio(struct usb_interfac
27 struct usb_device *dev = interface_to_usbdev(intf);
28 struct rio_usb_data *rio = &rio_instance;
32 - dev_info(&intf->dev, "USB Rio found at address %d\n", dev->devnum);
33 + mutex_lock(&rio500_mutex);
35 + dev_info(&intf->dev, "Second USB Rio at address %d refused\n", dev->devnum);
39 + dev_info(&intf->dev, "USB Rio found at address %d\n", dev->devnum);
42 retval = usb_register_dev(intf, &usb_rio_class);
45 "Not able to get a minor for this device.\n");
52 @@ -464,7 +472,8 @@ static int probe_rio(struct usb_interfac
54 "probe_rio: Not enough memory for the output buffer\n");
55 usb_deregister_dev(intf, &usb_rio_class);
60 dev_dbg(&intf->dev, "obuf address:%p\n", rio->obuf);
62 @@ -473,7 +482,8 @@ static int probe_rio(struct usb_interfac
63 "probe_rio: Not enough memory for the input buffer\n");
64 usb_deregister_dev(intf, &usb_rio_class);
70 dev_dbg(&intf->dev, "ibuf address:%p\n", rio->ibuf);
72 @@ -481,8 +491,10 @@ static int probe_rio(struct usb_interfac
74 usb_set_intfdata (intf, rio);
77 + mutex_unlock(&rio500_mutex);
83 static void disconnect_rio(struct usb_interface *intf)