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

Commit 102be7c1 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "usb: f_fs: Prevent race between ep0_release & reset_work"

parents 149a269c f431a2ba
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -1936,11 +1936,13 @@ static void ffs_data_closed(struct ffs_data *ffs)
	if (atomic_dec_and_test(&ffs->opened)) {
		if (ffs->no_disconnect) {
			ffs->state = FFS_DEACTIVATED;
			mutex_lock(&ffs->mutex);
			if (ffs->epfiles) {
				ffs_epfiles_destroy(ffs->epfiles,
						   ffs->eps_count);
				ffs->epfiles = NULL;
			}
			mutex_unlock(&ffs->mutex);
			if (ffs->setup_state == FFS_SETUP_PENDING)
				__ffs_ep0_stall(ffs);
		} else {
@@ -2008,8 +2010,12 @@ static void ffs_data_clear(struct ffs_data *ffs)

	BUG_ON(ffs->gadget);

	if (ffs->epfiles)
	mutex_lock(&ffs->mutex);
	if (ffs->epfiles) {
		ffs_epfiles_destroy(ffs->epfiles, ffs->eps_count);
		ffs->epfiles = NULL;
	}
	mutex_unlock(&ffs->mutex);

	if (ffs->ffs_eventfd)
		eventfd_ctx_put(ffs->ffs_eventfd);
@@ -2028,7 +2034,6 @@ static void ffs_data_reset(struct ffs_data *ffs)

	ffs_data_clear(ffs);

	ffs->epfiles = NULL;
	ffs->raw_descs_data = NULL;
	ffs->raw_descs = NULL;
	ffs->raw_strings = NULL;