From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org, Wei Xu <xuwei5@hisilicon.com>,
Guodong Xu <guodong.xu@linaro.org>,
Amit Pundir <amit.pundir@linaro.org>,
YongQin Liu <yongqin.liu@linaro.org>,
John Youn <johnyoun@synopsys.com>,
Minas Harutyunyan <Minas.Harutyunyan@synopsys.com>,
Douglas Anderson <dianders@chromium.org>,
Chen Yu <chenyu56@huawei.com>,
Felipe Balbi <felipe.balbi@linux.intel.com>,
linux-usb@vger.kernel.org,
Minas Harutyunyan <hminas@synopsys.com>,
John Stultz <john.stultz@linaro.org>,
Sasha Levin <alexander.levin@verizon.com>
Subject: [PATCH 4.4 14/49] usb: dwc2: Error out of dwc2_hsotg_ep_disable() if were in host mode
Date: Thu, 7 Dec 2017 14:07:08 +0100 [thread overview]
Message-ID: <20171207124705.773958116@linuxfoundation.org> (raw)
In-Reply-To: <20171207124703.742654162@linuxfoundation.org>
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Stultz <john.stultz@linaro.org>
[ Upstream commit 9b481092c2a31a6b630aff9c28f0145bf6683787 ]
We've found that while in host mode, using Android, if one runs
the command:
stop adbd
The existing usb devices being utilized in host mode are disconnected.
This is most visible with usb networking devices.
This seems to be due to adbd closing the file:
/dev/usb-ffs/adb/ep0
Which calls ffs_ep0_release() and the following backtrace:
[<ffffff800875a430>] dwc2_hsotg_ep_disable+0x148/0x150
[<ffffff800875a498>] dwc2_hsotg_udc_stop+0x60/0x110
[<ffffff8008787950>] usb_gadget_remove_driver+0x58/0x78
[<ffffff80087879e4>] usb_gadget_unregister_driver+0x74/0xe8
[<ffffff80087850c0>] unregister_gadget+0x28/0x58
[<ffffff800878511c>] unregister_gadget_item+0x2c/0x40
[<ffffff8008790ea8>] ffs_data_clear+0xe8/0xf8
[<ffffff8008790ed8>] ffs_data_reset+0x20/0x58
[<ffffff8008793218>] ffs_data_closed+0x98/0xe8
[<ffffff80087932d8>] ffs_ep0_release+0x20/0x30
Then when dwc2_hsotg_ep_disable() is called, we call
kill_all_requests() which causes a bunch of the following
messages:
dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode
dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode
dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode
dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode
dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode
dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode
dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode
dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode
init: Service 'adbd' (pid 1915) killed by signal 9
init: Sending signal 9 to service 'adbd' (pid 1915) process group...
init: Successfully killed process cgroup uid 0 pid 1915 in 0ms
init: processing action (init.svc.adbd=stopped) from (/init.usb.configfs.rc:15)
dwc2 f72c0000.usb: dwc2_hc_chhltd_intr_dma: Channel 8 - ChHltd set, but reason is unknown
dwc2 f72c0000.usb: hcint 0x00000002, intsts 0x04200029
dwc2 f72c0000.usb: dwc2_hc_chhltd_intr_dma: Channel 12 - ChHltd set, but reason is unknown
dwc2 f72c0000.usb: hcint 0x00000002, intsts 0x04200029
dwc2 f72c0000.usb: dwc2_hc_chhltd_intr_dma: Channel 15 - ChHltd set, but reason is unknown
dwc2 f72c0000.usb: hcint 0x00000002, intsts 0x04200029
dwc2 f72c0000.usb: dwc2_hc_chhltd_intr_dma: Channel 3 - ChHltd set, but reason is unknown
dwc2 f72c0000.usb: hcint 0x00000002, intsts 0x04200029
dwc2 f72c0000.usb: dwc2_hc_chhltd_intr_dma: Channel 4 - ChHltd set, but reason is unknown
dwc2 f72c0000.usb: hcint 0x00000002, intsts 0x04200029
dwc2 f72c0000.usb: dwc2_update_urb_state_abn(): trimming xfer length
And the usb devices connected are basically hung at this point.
It seems like if we're in host mode, we probably shouldn't run
the dwc2_hostg_ep_disable logic, so this patch returns an error
in that case.
With this patch (along with the previous patch in this set), we avoid
the mismatched interrupts and connected usb devices continue to function.
I'm not sure if some other solution would be better here, but this seems
to work, so I wanted to send it out for input on what the right approach
should be.
Cc: Wei Xu <xuwei5@hisilicon.com>
Cc: Guodong Xu <guodong.xu@linaro.org>
Cc: Amit Pundir <amit.pundir@linaro.org>
Cc: YongQin Liu <yongqin.liu@linaro.org>
Cc: John Youn <johnyoun@synopsys.com>
Cc: Minas Harutyunyan <Minas.Harutyunyan@synopsys.com>
Cc: Douglas Anderson <dianders@chromium.org>
Cc: Chen Yu <chenyu56@huawei.com>
Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org
Acked-by: Minas Harutyunyan <hminas@synopsys.com>
Tested-by: Minas Harutyunyan <hminas@synopsys.com>
Reported-by: YongQin Liu <yongqin.liu@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/usb/dwc2/gadget.c | 5 +++++
1 file changed, 5 insertions(+)
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -2834,6 +2834,11 @@ static int dwc2_hsotg_ep_disable(struct
return -EINVAL;
}
+ if (hsotg->op_state != OTG_STATE_B_PERIPHERAL) {
+ dev_err(hsotg->dev, "%s: called in host mode?\n", __func__);
+ return -EINVAL;
+ }
+
epctrl_reg = dir_in ? DIEPCTL(index) : DOEPCTL(index);
spin_lock_irqsave(&hsotg->lock, flags);
next prev parent reply other threads:[~2017-12-07 13:09 UTC|newest]
Thread overview: 71+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-07 13:06 [PATCH 4.4 00/49] 4.4.105-stable review Greg Kroah-Hartman
2017-12-07 13:06 ` [PATCH 4.4 01/49] bcache: only permit to recovery read error when cache device is clean Greg Kroah-Hartman
2017-12-07 13:06 ` [PATCH 4.4 02/49] bcache: recover data from backing when data " Greg Kroah-Hartman
2017-12-07 13:06 ` [PATCH 4.4 03/49] uas: Always apply US_FL_NO_ATA_1X quirk to Seagate devices Greg Kroah-Hartman
2017-12-07 13:06 ` [PATCH 4.4 04/49] usb: quirks: Add no-lpm quirk for KY-688 USB 3.1 Type-C Hub Greg Kroah-Hartman
2017-12-07 13:06 ` [PATCH 4.4 05/49] serial: 8250_pci: Add Amazon PCI serial device ID Greg Kroah-Hartman
2017-12-07 13:07 ` [PATCH 4.4 06/49] s390/runtime instrumentation: simplify task exit handling Greg Kroah-Hartman
2017-12-07 13:07 ` [PATCH 4.4 07/49] USB: serial: option: add Quectel BG96 id Greg Kroah-Hartman
2017-12-07 13:07 ` [PATCH 4.4 08/49] ima: fix hash algorithm initialization Greg Kroah-Hartman
2017-12-07 13:07 ` [PATCH 4.4 09/49] s390/pci: do not require AIS facility Greg Kroah-Hartman
2017-12-07 13:07 ` [PATCH 4.4 10/49] selftests/x86/ldt_get: Add a few additional tests for limits Greg Kroah-Hartman
2017-12-07 13:07 ` [PATCH 4.4 11/49] serial: 8250_fintek: Fix rs485 disablement on invalid ioctl() Greg Kroah-Hartman
2017-12-07 13:07 ` [PATCH 4.4 12/49] spi: sh-msiof: Fix DMA transfer size check Greg Kroah-Hartman
2017-12-07 13:07 ` [PATCH 4.4 13/49] usb: dwc2: Fix UDC state tracking Greg Kroah-Hartman
2017-12-08 3:37 ` Ben Hutchings
2017-12-09 17:12 ` Greg Kroah-Hartman
2017-12-12 0:27 ` alexander.levin
2017-12-07 13:07 ` Greg Kroah-Hartman [this message]
2017-12-07 13:07 ` [PATCH 4.4 15/49] usb: phy: tahvo: fix error handling in tahvo_usb_probe() Greg Kroah-Hartman
2017-12-07 13:07 ` [PATCH 4.4 16/49] serial: 8250: Preserve DLD[7:4] for PORT_XR17V35X Greg Kroah-Hartman
2017-12-07 13:07 ` [PATCH 4.4 17/49] x86/entry: Use SYSCALL_DEFINE() macros for sys_modify_ldt() Greg Kroah-Hartman
2017-12-07 13:07 ` [PATCH 4.4 18/49] EDAC, sb_edac: Fix missing break in switch Greg Kroah-Hartman
2017-12-07 13:07 ` [PATCH 4.4 19/49] sysrq : fix Show Regs call trace on ARM Greg Kroah-Hartman
2017-12-07 13:07 ` [PATCH 4.4 20/49] usbip: tools: Install all headers needed for libusbip development Greg Kroah-Hartman
2017-12-08 3:56 ` Ben Hutchings
2017-12-09 6:16 ` alexander.levin
2017-12-09 7:41 ` Greg Kroah-Hartman
2017-12-12 0:13 ` alexander.levin
2017-12-12 7:22 ` Greg Kroah-Hartman
2017-12-09 17:06 ` Greg Kroah-Hartman
2017-12-07 13:07 ` [PATCH 4.4 21/49] perf test attr: Fix ignored test case result Greg Kroah-Hartman
2017-12-07 13:07 ` [PATCH 4.4 22/49] kprobes/x86: Disable preemption in ftrace-based jprobes Greg Kroah-Hartman
2017-12-07 13:07 ` [PATCH 4.4 23/49] net: systemport: Utilize skb_put_padto() Greg Kroah-Hartman
2017-12-07 13:07 ` [PATCH 4.4 24/49] net: systemport: Pad packet before inserting TSB Greg Kroah-Hartman
2017-12-07 13:07 ` [PATCH 4.4 25/49] ARM: OMAP1: DMA: Correct the number of logical channels Greg Kroah-Hartman
2017-12-07 13:07 ` [PATCH 4.4 26/49] vti6: fix device register to report IFLA_INFO_KIND Greg Kroah-Hartman
2017-12-07 13:07 ` [PATCH 4.4 27/49] net/appletalk: Fix kernel memory disclosure Greg Kroah-Hartman
2017-12-07 13:07 ` [PATCH 4.4 28/49] ravb: Remove Rx overflow log messages Greg Kroah-Hartman
2017-12-07 13:07 ` [PATCH 4.4 29/49] nfs: Dont take a reference on fl->fl_file for LOCK operation Greg Kroah-Hartman
2017-12-08 4:18 ` Ben Hutchings
2017-12-09 17:01 ` Greg Kroah-Hartman
2017-12-07 13:07 ` [PATCH 4.4 30/49] KVM: arm/arm64: Fix occasional warning from the timer work function Greg Kroah-Hartman
2017-12-07 13:07 ` [PATCH 4.4 31/49] NFSv4: Fix client recovery when server reboots multiple times Greg Kroah-Hartman
2017-12-07 13:07 ` [PATCH 4.4 32/49] drm/exynos/decon5433: set STANDALONE_UPDATE_F on output enablement Greg Kroah-Hartman
2017-12-07 13:07 ` [PATCH 4.4 33/49] net: sctp: fix array overrun read on sctp_timer_tbl Greg Kroah-Hartman
2017-12-08 4:34 ` Ben Hutchings
2017-12-09 17:02 ` Greg Kroah-Hartman
2017-12-07 13:07 ` [PATCH 4.4 34/49] tipc: fix cleanup at module unload Greg Kroah-Hartman
2017-12-07 13:07 ` [PATCH 4.4 35/49] dmaengine: pl330: fix double lock Greg Kroah-Hartman
2017-12-07 13:07 ` [PATCH 4.4 36/49] tcp: correct memory barrier usage in tcp_check_space() Greg Kroah-Hartman
2017-12-07 13:07 ` [PATCH 4.4 37/49] mm: avoid returning VM_FAULT_RETRY from ->page_mkwrite handlers Greg Kroah-Hartman
2017-12-07 13:07 ` [PATCH 4.4 38/49] xen-netfront: Improve error handling during initialization Greg Kroah-Hartman
2017-12-08 5:10 ` Ben Hutchings
2017-12-09 17:04 ` Greg Kroah-Hartman
2017-12-07 13:07 ` [PATCH 4.4 39/49] net: fec: fix multicast filtering hardware setup Greg Kroah-Hartman
2017-12-07 13:07 ` [PATCH 4.4 40/49] Revert "ocfs2: should wait dio before inode lock in ocfs2_setattr()" Greg Kroah-Hartman
2017-12-07 13:07 ` [PATCH 4.4 41/49] usb: hub: Cycle HUB power when initialization fails Greg Kroah-Hartman
2017-12-07 13:07 ` [PATCH 4.4 42/49] usb: xhci: fix panic in xhci_free_virt_devices_depth_first Greg Kroah-Hartman
2017-12-07 13:07 ` [PATCH 4.4 43/49] usb: Add USB 3.1 Precision time measurement capability descriptor support Greg Kroah-Hartman
2017-12-07 13:07 ` [PATCH 4.4 44/49] usb: ch9: Add size macro for SSP dev cap descriptor Greg Kroah-Hartman
2017-12-07 13:07 ` [PATCH 4.4 45/49] USB: core: Add type-specific length check of BOS descriptors Greg Kroah-Hartman
2017-12-07 13:07 ` [PATCH 4.4 46/49] USB: Increase usbfs transfer limit Greg Kroah-Hartman
2017-12-07 13:07 ` [PATCH 4.4 47/49] USB: devio: Prevent integer overflow in proc_do_submiturb() Greg Kroah-Hartman
2017-12-07 13:07 ` [PATCH 4.4 48/49] USB: usbfs: Filter flags passed in from user space Greg Kroah-Hartman
2017-12-07 13:07 ` [PATCH 4.4 49/49] usb: host: fix incorrect updating of offset Greg Kroah-Hartman
2017-12-07 15:23 ` [PATCH 4.4 00/49] 4.4.105-stable review Nathan Chancellor
2017-12-07 20:06 ` Greg Kroah-Hartman
2017-12-07 20:54 ` Guenter Roeck
2017-12-08 0:06 ` Shuah Khan
2017-12-08 5:36 ` Naresh Kamboju
[not found] ` <5a299569.3bb0df0a.2b900.5bf0@mx.google.com>
[not found] ` <7hr2s5kn0w.fsf@baylibre.com>
2017-12-09 17:05 ` Greg Kroah-Hartman
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=20171207124705.773958116@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=Minas.Harutyunyan@synopsys.com \
--cc=alexander.levin@verizon.com \
--cc=amit.pundir@linaro.org \
--cc=chenyu56@huawei.com \
--cc=dianders@chromium.org \
--cc=felipe.balbi@linux.intel.com \
--cc=guodong.xu@linaro.org \
--cc=hminas@synopsys.com \
--cc=john.stultz@linaro.org \
--cc=johnyoun@synopsys.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=xuwei5@hisilicon.com \
--cc=yongqin.liu@linaro.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).