lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <lsq.1528380321.31224834@decadent.org.uk>
Date:   Thu, 07 Jun 2018 15:05:21 +0100
From:   Ben Hutchings <ben@...adent.org.uk>
To:     linux-kernel@...r.kernel.org, stable@...r.kernel.org
CC:     akpm@...ux-foundation.org, "John Stultz" <john.stultz@...aro.org>,
        "Felipe Balbi" <balbi@...nel.org>,
        "Android Kernel Team" <kernel-team@...roid.com>,
        "Michal Nazarewicz" <mina86@...a86.com>,
        "Badhri" <badhri@...gle.com>,
        "Greg KH" <gregkh@...ux-foundation.org>,
        "Dmitry Shmidt" <dimitrysh@...gle.com>,
        "Amit Pundir" <amit.pundir@...aro.org>,
        "Hemant Kumar" <hemantk@...eaurora.org>,
        "Greg Kroah-Hartman" <gregkh@...uxfoundation.org>
Subject: [PATCH 3.16 103/410] usb: f_fs: Prevent gadget unbind if it is
 already unbound

3.16.57-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Hemant Kumar <hemantk@...eaurora.org>

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 <balbi@...nel.org>
Cc: Greg KH <gregkh@...ux-foundation.org>
Cc: Michal Nazarewicz <mina86@...a86.com>
Cc: John Stultz <john.stultz@...aro.org>
Cc: Dmitry Shmidt <dimitrysh@...gle.com>
Cc: Badhri <badhri@...gle.com>
Cc: Android Kernel Team <kernel-team@...roid.com>
Signed-off-by: Hemant Kumar <hemantk@...eaurora.org>
[AmitP: Cherry-picked it from android-4.14 and updated the commit log]
Signed-off-by: Amit Pundir <amit.pundir@...aro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Signed-off-by: Ben Hutchings <ben@...adent.org.uk>
---
 drivers/usb/gadget/f_fs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/usb/gadget/f_fs.c
+++ b/drivers/usb/gadget/f_fs.c
@@ -3019,7 +3019,8 @@ static void ffs_closed(struct ffs_data *
 	ci = ffs_obj->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();

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ