From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org, Felipe Balbi <balbi@kernel.org>,
Michal Nazarewicz <mina86@mina86.com>,
John Stultz <john.stultz@linaro.org>,
Dmitry Shmidt <dimitrysh@google.com>, Badhri <badhri@google.com>,
Android Kernel Team <kernel-team@android.com>,
Hemant Kumar <hemantk@codeaurora.org>,
Amit Pundir <amit.pundir@linaro.org>,
Greg KH <gregkh@linux-foundation.org>
Subject: [PATCH 4.9 81/86] usb: f_fs: Prevent gadget unbind if it is already unbound
Date: Fri, 2 Feb 2018 17:58:41 +0100 [thread overview]
Message-ID: <20180202140830.100425500@linuxfoundation.org> (raw)
In-Reply-To: <20180202140822.679101338@linuxfoundation.org>
4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hemant Kumar <hemantk@codeaurora.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@kernel.org>
Cc: Greg KH <gregkh@linux-foundation.org>
Cc: Michal Nazarewicz <mina86@mina86.com>
Cc: John Stultz <john.stultz@linaro.org>
Cc: Dmitry Shmidt <dimitrysh@google.com>
Cc: Badhri <badhri@google.com>
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
[AmitP: Cherry-picked it from android-4.14 and updated the commit log]
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/usb/gadget/function/f_fs.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/drivers/usb/gadget/function/f_fs.c
+++ b/drivers/usb/gadget/function/f_fs.c
@@ -3725,7 +3725,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();
next prev parent reply other threads:[~2018-02-02 17:06 UTC|newest]
Thread overview: 78+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-02 16:57 [PATCH 4.9 00/86] 4.9.80-stable review Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.9 02/86] net/mlx5: Define interface bits for fencing UMR wqe Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.9 03/86] RDMA/mlx5: set UMR wqe fence according to HCA cap Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.9 05/86] gpio: stmpe: i2c transfer are forbiden in atomic context Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.9 06/86] gpio: Fix kernel stack leak to userspace Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.9 07/86] crypto: ecdh - fix typo in KPP dependency of CRYPTO_ECDH Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.9 08/86] crypto: aesni - handle zero length dst buffer Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.9 09/86] crypto: sha3-generic - fixes for alignment and big endian operation Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.9 10/86] crypto: af_alg - whitelist mask and type Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.9 11/86] HID: wacom: EKR: ensure devres groups at higher indexes are released Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.9 12/86] power: reset: zx-reboot: add missing MODULE_DESCRIPTION/AUTHOR/LICENSE Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.9 13/86] gpio: iop: " Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.9 14/86] gpio: ath79: add missing MODULE_DESCRIPTION/LICENSE Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.9 15/86] mtd: nand: denali_pci: add missing MODULE_DESCRIPTION/AUTHOR/LICENSE Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.9 16/86] igb: Free IRQs when device is hotplugged Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.9 17/86] drm/vc4: Account for interrupts in flight Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.9 18/86] cpupowerutils: bench - Fix cpu online check Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.9 19/86] cpupower : Fix cpupower working when cpu0 is offline Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.9 25/86] ACPI / bus: Leave modalias empty for devices which are not present Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.9 27/86] cpufreq: Add Loongson machine dependencies Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.9 28/86] bcache: check return value of register_shrinker Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.9 29/86] drm/amdgpu: Fix SDMA load/unload sequence on HWS disabled mode Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.9 30/86] drm/amdkfd: Fix SDMA ring buffer size calculation Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.9 31/86] drm/amdkfd: Fix SDMA oversubsription handling Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.9 32/86] openvswitch: fix the incorrect flow action alloc size Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.9 33/86] mac80211: fix the update of path metric for RANN frame Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.9 34/86] btrfs: fix deadlock when writing out space cache Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.9 35/86] reiserfs: remove unneeded i_version bump Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.9 38/86] xfs: always free inline data before resetting inode fork during ifree Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.9 39/86] xen-netfront: remove warning when unloading module Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.9 40/86] auxdisplay: img-ascii-lcd: Only build on archs that have IOMEM Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.9 41/86] nfsd: CLOSE SHOULD return the invalid special stateid for NFSv4.x (x>0) Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.9 42/86] nfsd: Ensure we check stateid validity in the seqid operation checks Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.9 43/86] grace: replace BUG_ON by WARN_ONCE in exit_net hook Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.9 44/86] nfsd: check for use of the closed special stateid Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.9 45/86] lockd: fix "list_add double add" caused by legacy signal interface Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.9 46/86] hwmon: (pmbus) Use 64bit math for DIRECT format values Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.9 47/86] bnxt_en: Fix an error handling path in bnxt_get_module_eeprom() Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.9 48/86] xfs: fortify xfs_alloc_buftarg error handling Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.9 50/86] net: ethernet: xilinx: Mark XILINX_LL_TEMAC broken on 64-bit Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.9 51/86] quota: Check for register_shrinker() failure Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.9 52/86] SUNRPC: Allow connect to return EHOSTUNREACH Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.9 53/86] kmemleak: add scheduling point to kmemleak_scan() Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.9 54/86] drm/bridge: tc358767: do no fail on hi-res displays Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.9 55/86] drm/bridge: tc358767: filter out too high modes Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.9 56/86] drm/bridge: tc358767: fix DP0_MISC register set Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.9 57/86] drm/bridge: tc358767: fix timing calculations Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.9 58/86] drm/bridge: tc358767: fix AUXDATAn registers access Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.9 59/86] drm/bridge: tc358767: fix 1-lane behavior Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.9 60/86] drm/omap: Fix error handling path in omap_dmm_probe() Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.9 61/86] xfs: ubsan fixes Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.9 62/86] xfs: Properly retry failed dquot items in case of error during buffer writeback Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.9 63/86] scsi: aacraid: Prevent crash in case of free interrupt during scsi EH path Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.9 64/86] scsi: ufs: ufshcd: fix potential NULL pointer dereference in ufshcd_config_vreg Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.9 65/86] iwlwifi: mvm: fix the TX queue hang timeout for MONITOR vif type Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.9 66/86] ARM: dts: NSP: Fix PPI interrupt types Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.9 67/86] media: usbtv: add a new usbid Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.9 68/86] usb: gadget: dont dereference g until after it has been null checked Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.9 69/86] staging: rtl8188eu: Fix incorrect response to SIOCGIWESSID Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.9 70/86] drm/vc4: Move IRQ enable to PM path Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.9 71/86] staging: lustre: separate a connection destroy from free struct kib_conn Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.9 72/86] tty: fix data race between tty_init_dev and flush of buf Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.9 73/86] usb: option: Add support for FS040U modem Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.9 75/86] USB: cdc-acm: Do not log urb submission errors on disconnect Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.9 76/86] CDC-ACM: apply quirk for card reader Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.9 77/86] USB: serial: io_edgeport: fix possible sleep-in-atomic Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.9 78/86] usbip: prevent bind loops on devices attached to vhci_hcd Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.9 79/86] usbip: list: dont list " Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.9 80/86] USB: serial: simple: add Motorola Tetra driver Greg Kroah-Hartman
2018-02-02 16:58 ` Greg Kroah-Hartman [this message]
2018-02-02 16:58 ` [PATCH 4.9 82/86] usb: uas: unconditionally bring back host after reset Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.9 83/86] usb/gadget: Fix "high bandwidth" check in usb_gadget_ep_match_desc() Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.9 84/86] usbip: vhci_hcd: clear just the USB_PORT_STAT_POWER bit Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.9 85/86] serial: imx: Only wakeup via RTSDEN bit if the system has RTS/CTS Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.9 86/86] spi: imx: do not access registers while clocks disabled Greg Kroah-Hartman
2018-02-02 22:19 ` [PATCH 4.9 00/86] 4.9.80-stable review Shuah Khan
2018-02-02 22:45 ` Dan Rue
2018-02-03 15:29 ` Guenter Roeck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180202140830.100425500@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=amit.pundir@linaro.org \
--cc=badhri@google.com \
--cc=balbi@kernel.org \
--cc=dimitrysh@google.com \
--cc=gregkh@linux-foundation.org \
--cc=hemantk@codeaurora.org \
--cc=john.stultz@linaro.org \
--cc=kernel-team@android.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mina86@mina86.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).