Unverified Commit 9ff44822 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files
parents 1e51a9c6 f79fa6ed
Loading
Loading
Loading
Loading
+13 −3
Original line number Diff line number Diff line
@@ -1069,14 +1069,24 @@ static ssize_t interface_authorized_store(struct device *dev,
{
	struct usb_interface *intf = to_usb_interface(dev);
	bool val;
	struct kernfs_node *kn;

	if (strtobool(buf, &val) != 0)
		return -EINVAL;

	if (val)
	if (val) {
		usb_authorize_interface(intf);
	else
	} else {
		/*
		 * Prevent deadlock if another process is concurrently
		 * trying to unregister intf.
		 */
		kn = sysfs_break_active_protection(&dev->kobj, &attr->attr);
		if (kn) {
			usb_deauthorize_interface(intf);
			sysfs_unbreak_active_protection(kn);
		}
	}

	return count;
}