Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f64c3b28 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "USB: android: Fix crash when F_FS gets descriptors before it is enabled"

parents 6c87ce36 75e91fe9
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -444,12 +444,23 @@ static void ffs_function_enable(struct android_usb_function *f)
{
	struct android_dev *dev = f->android_dev;
	struct functionfs_config *config = f->config;
	int ret = 0;

	config->enabled = true;

	/* Disable the gadget until the function is ready */
	if (!config->opened)
	if (!config->opened) {
		android_disable(dev);
	} else {
		/*
		 * Call functionfs_bind to handle the case where userspace
		 * passed descriptors before updating enabled functions list
		 */
		ret = functionfs_bind(config->data, dev->cdev);
		if (ret)
			pr_err("%s: functionfs_bind failed (%d)\n", __func__,
									ret);
	}
}

static void ffs_function_disable(struct android_usb_function *f)