Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

usb: iowarrior: remove inherent race with minor number

The driver saves the minor number it gets upon registration
in its descriptor for debugging purposes. However, there is
inevitably a window between registration and saving the correct
minor in a descriptor. During this window the debugging output
will be wrong.
As wrong debug output is worse than no debug output, just
remove it.

Signed-off-by: Oliver Neukum <oneukum@suse.com>
Link: https://patch.msgid.link/20260312094619.1590556-1-oneukum@suse.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Oliver Neukum and committed by
Greg Kroah-Hartman
56dd2908 916aeaff

+3 -14
+3 -14
drivers/usb/misc/iowarrior.c
··· 74 74 struct mutex mutex; /* locks this structure */ 75 75 struct usb_device *udev; /* save off the usb device pointer */ 76 76 struct usb_interface *interface; /* the interface for this device */ 77 - unsigned char minor; /* the starting minor number for this device */ 78 77 struct usb_endpoint_descriptor *int_out_endpoint; /* endpoint for reading (needed for IOW56 only) */ 79 78 struct usb_endpoint_descriptor *int_in_endpoint; /* endpoint for reading */ 80 79 struct urb *int_in_urb; /* the urb for reading data */ ··· 245 246 */ 246 247 static inline void iowarrior_delete(struct iowarrior *dev) 247 248 { 248 - dev_dbg(&dev->interface->dev, "minor %d\n", dev->minor); 249 249 kfree(dev->int_in_buffer); 250 250 usb_free_urb(dev->int_in_urb); 251 251 kfree(dev->read_queue); ··· 294 296 retval = -ENODEV; 295 297 goto exit; 296 298 } 297 - 298 - dev_dbg(&dev->interface->dev, "minor %d, count = %zd\n", 299 - dev->minor, count); 300 299 301 300 /* read count must be packet size (+ time stamp) */ 302 301 if ((count != dev->report_size) ··· 374 379 retval = -ENODEV; 375 380 goto exit; 376 381 } 377 - dev_dbg(&dev->interface->dev, "minor %d, count = %zd\n", 378 - dev->minor, count); 379 382 /* if count is 0 we're already done */ 380 383 if (count == 0) { 381 384 retval = 0; ··· 515 522 retval = -ENODEV; 516 523 goto error_out; 517 524 } 518 - 519 - dev_dbg(&dev->interface->dev, "minor %d, cmd 0x%.4x, arg %ld\n", 520 - dev->minor, cmd, arg); 521 525 522 526 retval = 0; 523 527 switch (cmd) { ··· 661 671 if (!dev) 662 672 return -ENODEV; 663 673 664 - dev_dbg(&dev->interface->dev, "minor %d\n", dev->minor); 665 - 666 674 /* lock our device */ 667 675 mutex_lock(&dev->mutex); 668 676 ··· 763 775 struct usb_host_interface *iface_desc; 764 776 int retval = -ENOMEM; 765 777 int res; 778 + int minor; 766 779 767 780 /* allocate memory for our device state and initialize it */ 768 781 dev = kzalloc_obj(struct iowarrior); ··· 879 890 goto error; 880 891 } 881 892 882 - dev->minor = interface->minor; 893 + minor = interface->minor; 883 894 884 895 /* let the user know what node this device is now attached to */ 885 896 dev_info(&interface->dev, "IOWarrior product=0x%x, serial=%s interface=%d " 886 897 "now attached to iowarrior%d\n", dev->product_id, dev->chip_serial, 887 - iface_desc->desc.bInterfaceNumber, dev->minor - IOWARRIOR_MINOR_BASE); 898 + iface_desc->desc.bInterfaceNumber, minor - IOWARRIOR_MINOR_BASE); 888 899 return retval; 889 900 890 901 error: