mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-01-19 13:26:11 +07:00
USB: cdc-acm: fix sysfs attribute registration bug
This patch (as950) fixes a bug in the cdc-acm driver. It doesn't keep track of which interface (control or data) the sysfs attributes get registered for, and as a result, during disconnect it will sometimes attempt to remove the attributes from the wrong interface. The left-over attributes can cause a crash later on, particularly if the driver module has been unloaded. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Acked-by: Oliver Neukum <oneukum@suse.de> Cc: stable <stable@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
8c27303390
commit
74da5d68a5
@ -921,6 +921,10 @@ static int acm_probe (struct usb_interface *intf,
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Accept probe requests only for the control interface */
|
||||
if (intf != control_interface)
|
||||
return -ENODEV;
|
||||
|
||||
if (usb_interface_claimed(data_interface)) { /* valid in this context */
|
||||
dev_dbg(&intf->dev,"The data interface isn't available");
|
||||
@ -1109,10 +1113,12 @@ static void acm_disconnect(struct usb_interface *intf)
|
||||
return;
|
||||
}
|
||||
if (acm->country_codes){
|
||||
device_remove_file(&intf->dev, &dev_attr_wCountryCodes);
|
||||
device_remove_file(&intf->dev, &dev_attr_iCountryCodeRelDate);
|
||||
device_remove_file(&acm->control->dev,
|
||||
&dev_attr_wCountryCodes);
|
||||
device_remove_file(&acm->control->dev,
|
||||
&dev_attr_iCountryCodeRelDate);
|
||||
}
|
||||
device_remove_file(&intf->dev, &dev_attr_bmCapabilities);
|
||||
device_remove_file(&acm->control->dev, &dev_attr_bmCapabilities);
|
||||
acm->dev = NULL;
|
||||
usb_set_intfdata(acm->control, NULL);
|
||||
usb_set_intfdata(acm->data, NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user