Skip to contentSkip to conversation

Patch "usb: f_fs: Prevent gadget unbind if it is already unbound" has been added to the 4.15-stable tree

PATCH [email protected] 1 participant 1 message Feb 2, 2018

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

usb: f_fs: Prevent gadget unbind if it is already unbound

to the 4.15-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
usb-f_fs-prevent-gadget-unbind-if-it-is-already-unbound.patch
and it can be found in the queue-4.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From ce5bf9a50daf2d9078b505aca1cea22e88ecb94a Mon Sep 17 00:00:00 2001

From: Hemant Kumar <[email protected]>
Date: Tue, 9 Jan 2018 12:30:53 +0530
Subject: usb: f_fs: Prevent gadget unbind if it is already unbound

From: Hemant Kumar <[email protected]>

commit ce5bf9a50daf2d9078b505aca1cea22e88ecb94a upstream.

Upon usb composition switch there is possibility of ep0 file release happening after gadget driver bind. In case of composition switch from adb to a non-adb composition gadget will never gets bound again resulting into failure of usb device enumeration. Fix this issue by checking FFS_FL_BOUND flag and avoid extra gadget driver unbind if it is already done as part of composition switch.

This fixes adb reconnection error reported on Android running v4.4 and above kernel versions. Verified on Hikey running vanilla v4.15-rc7 + few out of tree Mali patches.

Reviewed-at: https://android-review.googlesource.com/#/c/582632/

Cc Felipe Balbi <[email protected]>
Cc Greg KH <[email protected]>
Cc Michal Nazarewicz <[email protected]>
Cc John Stultz <[email protected]>
Cc Dmitry Shmidt <[email protected]>
Cc Badhri <[email protected]>
Cc Android Kernel Team <[email protected]>
[AmitP: Cherry-picked it from android-4.14 and updated the commit log]
---
 drivers/usb/gadget/function/f_fs.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/gadget/function/f_fs.c +2 -1
@@ -3700,7 +3700,8 @@ static void ffs_closed(struct ffs_data *
 	ci = opts->func_inst.group.cg_item.ci_parent->ci_parent;
 	ffs_dev_unlock();
 
-	unregister_gadget_item(ci);
+	if (test_bit(FFS_FL_BOUND, &ffs->flags))
+		unregister_gadget_item(ci);
 	return;
 done:
 	ffs_dev_unlock();

Patches currently in stable-queue which might be from [email protected] are

queue-4.15/usb-f_fs-prevent-gadget-unbind-if-it-is-already-unbound.patch