From 93e8e996c8b93fff2acf8833c03492146b95b9a5 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 27 Jun 2014 12:18:43 -0700 Subject: [PATCH] 3.4-stable patches added patches: applicom-dereferencing-null-on-error-path.patch can-peak_pci-prevent-use-after-free-at-netdev-removal.patch staging-tidspbridge-check-for-config_snd_omap_soc_mcbsp.patch usb-dwc3-gadget-clear-stall-when-disabling-endpoint.patch usb-ehci-avoid-bios-handover-on-the-hasee-e200.patch usb-gadget-rename-config_usb_gadget_pxa25x.patch usb-usbtest-add-a-timeout-for-scatter-gather-tests.patch usb-usbtest-fix-unlink-write-error-with-pattern-1.patch --- queue-3.10/series | 12 ++++ queue-3.14/series | 19 +++++ queue-3.15/series | 19 +++++ ...com-dereferencing-null-on-error-path.patch | 30 ++++++++ ...ent-use-after-free-at-netdev-removal.patch | 69 ++++++++++++++++++ queue-3.4/series | 8 +++ ...-check-for-config_snd_omap_soc_mcbsp.patch | 46 ++++++++++++ ...-clear-stall-when-disabling-endpoint.patch | 35 +++++++++ ...void-bios-handover-on-the-hasee-e200.patch | 61 ++++++++++++++++ ...dget-rename-config_usb_gadget_pxa25x.patch | 34 +++++++++ ...d-a-timeout-for-scatter-gather-tests.patch | 72 +++++++++++++++++++ ...ix-unlink-write-error-with-pattern-1.patch | 68 ++++++++++++++++++ 12 files changed, 473 insertions(+) create mode 100644 queue-3.10/series create mode 100644 queue-3.14/series create mode 100644 queue-3.15/series create mode 100644 queue-3.4/applicom-dereferencing-null-on-error-path.patch create mode 100644 queue-3.4/can-peak_pci-prevent-use-after-free-at-netdev-removal.patch create mode 100644 queue-3.4/series create mode 100644 queue-3.4/staging-tidspbridge-check-for-config_snd_omap_soc_mcbsp.patch create mode 100644 queue-3.4/usb-dwc3-gadget-clear-stall-when-disabling-endpoint.patch create mode 100644 queue-3.4/usb-ehci-avoid-bios-handover-on-the-hasee-e200.patch create mode 100644 queue-3.4/usb-gadget-rename-config_usb_gadget_pxa25x.patch create mode 100644 queue-3.4/usb-usbtest-add-a-timeout-for-scatter-gather-tests.patch create mode 100644 queue-3.4/usb-usbtest-fix-unlink-write-error-with-pattern-1.patch diff --git a/queue-3.10/series b/queue-3.10/series new file mode 100644 index 00000000000..6d59f57155f --- /dev/null +++ b/queue-3.10/series @@ -0,0 +1,12 @@ +can-peak_pci-prevent-use-after-free-at-netdev-removal.patch +af_iucv-wrong-mapping-of-sent-and-confirmed-skbs.patch +net-cpsw-fix-null-dereference-at-probe.patch +extcon-max8997-fix-null-pointer-exception-on-missing-pdata.patch +staging-tidspbridge-check-for-config_snd_omap_soc_mcbsp.patch +applicom-dereferencing-null-on-error-path.patch +usb-usbtest-fix-unlink-write-error-with-pattern-1.patch +usb-usbtest-add-a-timeout-for-scatter-gather-tests.patch +usb-gadget-rename-config_usb_gadget_pxa25x.patch +usb-dwc3-gadget-clear-stall-when-disabling-endpoint.patch +arm-omap-replace-checks-for-config_usb_gadget_omap.patch +usb-ehci-avoid-bios-handover-on-the-hasee-e200.patch diff --git a/queue-3.14/series b/queue-3.14/series new file mode 100644 index 00000000000..e1fed78c308 --- /dev/null +++ b/queue-3.14/series @@ -0,0 +1,19 @@ +revert-net-eth-cpsw-correctly-attach-to-gpio-bitbang-mdio.patch +can-peak_pci-prevent-use-after-free-at-netdev-removal.patch +af_iucv-wrong-mapping-of-sent-and-confirmed-skbs.patch +net-cpsw-fix-null-dereference-at-probe.patch +extcon-max8997-fix-null-pointer-exception-on-missing-pdata.patch +extcon-max77693-fix-two-null-pointer-exceptions-on-missing-pdata.patch +extcon-max14577-fix-probe-failure-on-successful-work-queue.patch +extcon-max14577-properly-handle-regmap_irq_get_virq-error.patch +phy-exynos-mipi-video-fix-check-on-array-index.patch +staging-tidspbridge-check-for-config_snd_omap_soc_mcbsp.patch +staging-rtl8188eu-overflow-in-update_sta_support_rate.patch +staging-mt29f_spinand-terminate-of-match-table.patch +applicom-dereferencing-null-on-error-path.patch +usb-usbtest-fix-unlink-write-error-with-pattern-1.patch +usb-usbtest-add-a-timeout-for-scatter-gather-tests.patch +usb-gadget-rename-config_usb_gadget_pxa25x.patch +usb-dwc3-gadget-clear-stall-when-disabling-endpoint.patch +arm-omap-replace-checks-for-config_usb_gadget_omap.patch +usb-ehci-avoid-bios-handover-on-the-hasee-e200.patch diff --git a/queue-3.15/series b/queue-3.15/series new file mode 100644 index 00000000000..d63a5ffae9a --- /dev/null +++ b/queue-3.15/series @@ -0,0 +1,19 @@ +imx-drm-fix-hdmi-hotplug-detection-initial-state.patch +block-virtio_blk-don-t-hold-spin-lock-during-world-switch.patch +extcon-max8997-fix-null-pointer-exception-on-missing-pdata.patch +extcon-max77693-fix-two-null-pointer-exceptions-on-missing-pdata.patch +extcon-max14577-fix-probe-failure-on-successful-work-queue.patch +extcon-max14577-properly-handle-regmap_irq_get_virq-error.patch +w1-do-not-unlock-unheld-list_mutex-in-__w1_remove_master_device.patch +printk-of_serial-fix-serial-console-cessation-part-way-through-boot.patch +phy-exynos-mipi-video-fix-check-on-array-index.patch +staging-tidspbridge-check-for-config_snd_omap_soc_mcbsp.patch +staging-rtl8188eu-overflow-in-update_sta_support_rate.patch +staging-mt29f_spinand-terminate-of-match-table.patch +applicom-dereferencing-null-on-error-path.patch +usb-usbtest-fix-unlink-write-error-with-pattern-1.patch +usb-usbtest-add-a-timeout-for-scatter-gather-tests.patch +usb-gadget-rename-config_usb_gadget_pxa25x.patch +usb-dwc3-gadget-clear-stall-when-disabling-endpoint.patch +arm-omap-replace-checks-for-config_usb_gadget_omap.patch +usb-ehci-avoid-bios-handover-on-the-hasee-e200.patch diff --git a/queue-3.4/applicom-dereferencing-null-on-error-path.patch b/queue-3.4/applicom-dereferencing-null-on-error-path.patch new file mode 100644 index 00000000000..3030249d83b --- /dev/null +++ b/queue-3.4/applicom-dereferencing-null-on-error-path.patch @@ -0,0 +1,30 @@ +From 8bab797c6e5724a43b7666ad70860712365cdb71 Mon Sep 17 00:00:00 2001 +From: Dan Carpenter +Date: Fri, 9 May 2014 14:59:16 +0300 +Subject: applicom: dereferencing NULL on error path + +From: Dan Carpenter + +commit 8bab797c6e5724a43b7666ad70860712365cdb71 upstream. + +This is a static checker fix. The "dev" variable is always NULL after +the while statement so we would be dereferencing a NULL pointer here. + +Fixes: 819a3eba4233 ('[PATCH] applicom: fix error handling') +Signed-off-by: Dan Carpenter +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/char/applicom.c | 1 - + 1 file changed, 1 deletion(-) + +--- a/drivers/char/applicom.c ++++ b/drivers/char/applicom.c +@@ -345,7 +345,6 @@ out: + free_irq(apbs[i].irq, &dummy); + iounmap(apbs[i].RamIO); + } +- pci_disable_device(dev); + return ret; + } + diff --git a/queue-3.4/can-peak_pci-prevent-use-after-free-at-netdev-removal.patch b/queue-3.4/can-peak_pci-prevent-use-after-free-at-netdev-removal.patch new file mode 100644 index 00000000000..8f37748bc1e --- /dev/null +++ b/queue-3.4/can-peak_pci-prevent-use-after-free-at-netdev-removal.patch @@ -0,0 +1,69 @@ +From 0b5a958cf4df3a5cd578b861471e62138f55c85e Mon Sep 17 00:00:00 2001 +From: Stephane Grosjean +Date: Tue, 20 May 2014 11:38:56 +0200 +Subject: can: peak_pci: prevent use after free at netdev removal + +From: Stephane Grosjean + +commit 0b5a958cf4df3a5cd578b861471e62138f55c85e upstream. + +As remarked by Christopher R. Baker in his post at + +http://marc.info/?l=linux-can&m=139707295706465&w=2 + +there's a possibility for an use after free condition at device removal. + +This simplified patch introduces an additional variable to prevent the issue. +Thanks for catching this. + +Reported-by: Christopher R. Baker +Signed-off-by: Stephane Grosjean +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/can/sja1000/peak_pci.c | 14 +++++++++----- + 1 file changed, 9 insertions(+), 5 deletions(-) + +--- a/drivers/net/can/sja1000/peak_pci.c ++++ b/drivers/net/can/sja1000/peak_pci.c +@@ -547,7 +547,7 @@ static int __devinit peak_pci_probe(stru + { + struct sja1000_priv *priv; + struct peak_pci_chan *chan; +- struct net_device *dev; ++ struct net_device *dev, *prev_dev; + void __iomem *cfg_base, *reg_base; + u16 sub_sys_id, icr; + int i, err, channels; +@@ -681,11 +681,13 @@ failure_remove_channels: + writew(0x0, cfg_base + PITA_ICR + 2); + + chan = NULL; +- for (dev = pci_get_drvdata(pdev); dev; dev = chan->prev_dev) { +- unregister_sja1000dev(dev); +- free_sja1000dev(dev); ++ for (dev = pci_get_drvdata(pdev); dev; dev = prev_dev) { + priv = netdev_priv(dev); + chan = priv->priv; ++ prev_dev = chan->prev_dev; ++ ++ unregister_sja1000dev(dev); ++ free_sja1000dev(dev); + } + + /* free any PCIeC resources too */ +@@ -719,10 +721,12 @@ static void __devexit peak_pci_remove(st + + /* Loop over all registered devices */ + while (1) { ++ struct net_device *prev_dev = chan->prev_dev; ++ + dev_info(&pdev->dev, "removing device %s\n", dev->name); + unregister_sja1000dev(dev); + free_sja1000dev(dev); +- dev = chan->prev_dev; ++ dev = prev_dev; + + if (!dev) { + /* do that only for first channel */ diff --git a/queue-3.4/series b/queue-3.4/series new file mode 100644 index 00000000000..ed77eca90d0 --- /dev/null +++ b/queue-3.4/series @@ -0,0 +1,8 @@ +can-peak_pci-prevent-use-after-free-at-netdev-removal.patch +staging-tidspbridge-check-for-config_snd_omap_soc_mcbsp.patch +applicom-dereferencing-null-on-error-path.patch +usb-usbtest-fix-unlink-write-error-with-pattern-1.patch +usb-usbtest-add-a-timeout-for-scatter-gather-tests.patch +usb-gadget-rename-config_usb_gadget_pxa25x.patch +usb-dwc3-gadget-clear-stall-when-disabling-endpoint.patch +usb-ehci-avoid-bios-handover-on-the-hasee-e200.patch diff --git a/queue-3.4/staging-tidspbridge-check-for-config_snd_omap_soc_mcbsp.patch b/queue-3.4/staging-tidspbridge-check-for-config_snd_omap_soc_mcbsp.patch new file mode 100644 index 00000000000..8d8e26a8d9b --- /dev/null +++ b/queue-3.4/staging-tidspbridge-check-for-config_snd_omap_soc_mcbsp.patch @@ -0,0 +1,46 @@ +From d3921a03a89acb1b9ca599590c0131c89f8737d8 Mon Sep 17 00:00:00 2001 +From: Paul Bolle +Date: Mon, 26 May 2014 21:47:11 +0200 +Subject: staging: tidspbridge: check for CONFIG_SND_OMAP_SOC_MCBSP + +From: Paul Bolle + +commit d3921a03a89acb1b9ca599590c0131c89f8737d8 upstream. + +Commit d0f47ff17f29 ("ASoC: OMAP: Build config cleanup for McBSP") +removed the Kconfig symbol OMAP_MCBSP. It left two checks for +CONFIG_OMAP_MCBSP untouched. + +Convert these to checks for CONFIG_SND_OMAP_SOC_MCBSP. That must be +correct, since that re-enables calls to functions that are all found in +sound/soc/omap/mcbsp.c. And that file is built only if +CONFIG_SND_OMAP_SOC_MCBSP is defined. + +Fixes: d0f47ff17f29 ("ASoC: OMAP: Build config cleanup for McBSP") +Signed-off-by: Paul Bolle +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/staging/tidspbridge/core/dsp-clock.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/staging/tidspbridge/core/dsp-clock.c ++++ b/drivers/staging/tidspbridge/core/dsp-clock.c +@@ -213,7 +213,7 @@ int dsp_clk_enable(enum dsp_clk_id clk_i + case GPT_CLK: + status = omap_dm_timer_start(timer[clk_id - 1]); + break; +-#ifdef CONFIG_OMAP_MCBSP ++#ifdef CONFIG_SND_OMAP_SOC_MCBSP + case MCBSP_CLK: + omap_mcbsp_request(MCBSP_ID(clk_id)); + omap2_mcbsp_set_clks_src(MCBSP_ID(clk_id), MCBSP_CLKS_PAD_SRC); +@@ -289,7 +289,7 @@ int dsp_clk_disable(enum dsp_clk_id clk_ + case GPT_CLK: + status = omap_dm_timer_stop(timer[clk_id - 1]); + break; +-#ifdef CONFIG_OMAP_MCBSP ++#ifdef CONFIG_SND_OMAP_SOC_MCBSP + case MCBSP_CLK: + omap2_mcbsp_set_clks_src(MCBSP_ID(clk_id), MCBSP_CLKS_PRCM_SRC); + omap_mcbsp_free(MCBSP_ID(clk_id)); diff --git a/queue-3.4/usb-dwc3-gadget-clear-stall-when-disabling-endpoint.patch b/queue-3.4/usb-dwc3-gadget-clear-stall-when-disabling-endpoint.patch new file mode 100644 index 00000000000..a1205310763 --- /dev/null +++ b/queue-3.4/usb-dwc3-gadget-clear-stall-when-disabling-endpoint.patch @@ -0,0 +1,35 @@ +From 687ef9817df7ed960d14575b9033dde3d04631fe Mon Sep 17 00:00:00 2001 +From: Felipe Balbi +Date: Wed, 16 Apr 2014 10:30:33 -0500 +Subject: usb: dwc3: gadget: clear stall when disabling endpoint + +From: Felipe Balbi + +commit 687ef9817df7ed960d14575b9033dde3d04631fe upstream. + +so it seems like DWC3 IP doesn't clear stalls +automatically when we disable an endpoint, because +of that, we _must_ make sure stalls are cleared +before clearing the proper bit in DALEPENA register. + +Reported-by: Johannes Stezenbach +Signed-off-by: Felipe Balbi +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/dwc3/gadget.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/drivers/usb/dwc3/gadget.c ++++ b/drivers/usb/dwc3/gadget.c +@@ -531,6 +531,10 @@ static int __dwc3_gadget_ep_disable(stru + + dwc3_remove_requests(dwc, dep); + ++ /* make sure HW endpoint isn't stalled */ ++ if (dep->flags & DWC3_EP_STALL) ++ __dwc3_gadget_ep_set_halt(dep, 0); ++ + reg = dwc3_readl(dwc->regs, DWC3_DALEPENA); + reg &= ~DWC3_DALEPENA_EP(dep->number); + dwc3_writel(dwc->regs, DWC3_DALEPENA, reg); diff --git a/queue-3.4/usb-ehci-avoid-bios-handover-on-the-hasee-e200.patch b/queue-3.4/usb-ehci-avoid-bios-handover-on-the-hasee-e200.patch new file mode 100644 index 00000000000..598988f86cb --- /dev/null +++ b/queue-3.4/usb-ehci-avoid-bios-handover-on-the-hasee-e200.patch @@ -0,0 +1,61 @@ +From b0a50e92bda3c4aeb8017d4e6c6e92146ebd5c9b Mon Sep 17 00:00:00 2001 +From: Alan Stern +Date: Tue, 3 Jun 2014 11:00:27 -0400 +Subject: USB: EHCI: avoid BIOS handover on the HASEE E200 + +From: Alan Stern + +commit b0a50e92bda3c4aeb8017d4e6c6e92146ebd5c9b upstream. + +Leandro Liptak reports that his HASEE E200 computer hangs when we ask +the BIOS to hand over control of the EHCI host controller. This +definitely sounds like a bug in the BIOS, but at the moment there is +no way to fix it. + +This patch works around the problem by avoiding the handoff whenever +the motherboard and BIOS version match those of Leandro's computer. + +Signed-off-by: Alan Stern +Reported-by: Leandro Liptak +Tested-by: Leandro Liptak +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/host/pci-quirks.c | 19 ++++++++++++++++--- + 1 file changed, 16 insertions(+), 3 deletions(-) + +--- a/drivers/usb/host/pci-quirks.c ++++ b/drivers/usb/host/pci-quirks.c +@@ -555,6 +555,14 @@ static const struct dmi_system_id __devi + DMI_MATCH(DMI_BIOS_VERSION, "Lucid-"), + }, + }, ++ { ++ /* HASEE E200 */ ++ .matches = { ++ DMI_MATCH(DMI_BOARD_VENDOR, "HASEE"), ++ DMI_MATCH(DMI_BOARD_NAME, "E210"), ++ DMI_MATCH(DMI_BIOS_VERSION, "6.00"), ++ }, ++ }, + { } + }; + +@@ -564,9 +572,14 @@ static void __devinit ehci_bios_handoff( + { + int try_handoff = 1, tried_handoff = 0; + +- /* The Pegatron Lucid tablet sporadically waits for 98 seconds trying +- * the handoff on its unused controller. Skip it. */ +- if (pdev->vendor == 0x8086 && pdev->device == 0x283a) { ++ /* ++ * The Pegatron Lucid tablet sporadically waits for 98 seconds trying ++ * the handoff on its unused controller. Skip it. ++ * ++ * The HASEE E200 hangs when the semaphore is set (bugzilla #77021). ++ */ ++ if (pdev->vendor == 0x8086 && (pdev->device == 0x283a || ++ pdev->device == 0x27cc)) { + if (dmi_check_system(ehci_dmi_nohandoff_table)) + try_handoff = 0; + } diff --git a/queue-3.4/usb-gadget-rename-config_usb_gadget_pxa25x.patch b/queue-3.4/usb-gadget-rename-config_usb_gadget_pxa25x.patch new file mode 100644 index 00000000000..226dfc84089 --- /dev/null +++ b/queue-3.4/usb-gadget-rename-config_usb_gadget_pxa25x.patch @@ -0,0 +1,34 @@ +From d30f2065d6da377cc76771aca5a9850cfca8723b Mon Sep 17 00:00:00 2001 +From: Paul Bolle +Date: Mon, 26 May 2014 23:37:09 +0200 +Subject: usb: gadget: rename CONFIG_USB_GADGET_PXA25X + +From: Paul Bolle + +commit d30f2065d6da377cc76771aca5a9850cfca8723b upstream. + +Commit 193ab2a60700 ("usb: gadget: allow multiple gadgets to be built") +basically renamed the Kconfig symbol USB_GADGET_PXA25X to USB_PXA25X. It +did not rename the related macros in use at that time. Commit +c0a39151a405 ("ARM: pxa: fix inconsistent CONFIG_USB_PXA27X") did so for +all but one macro. Rename that last macro too now. + +Fixes: 193ab2a60700 ("usb: gadget: allow multiple gadgets to be built") +Signed-off-by: Paul Bolle +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/gadget/inode.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/usb/gadget/inode.c ++++ b/drivers/usb/gadget/inode.c +@@ -1499,7 +1499,7 @@ gadgetfs_setup (struct usb_gadget *gadge + } + break; + +-#ifndef CONFIG_USB_GADGET_PXA25X ++#ifndef CONFIG_USB_PXA25X + /* PXA automagically handles this request too */ + case USB_REQ_GET_CONFIGURATION: + if (ctrl->bRequestType != 0x80) diff --git a/queue-3.4/usb-usbtest-add-a-timeout-for-scatter-gather-tests.patch b/queue-3.4/usb-usbtest-add-a-timeout-for-scatter-gather-tests.patch new file mode 100644 index 00000000000..cd45aa2832a --- /dev/null +++ b/queue-3.4/usb-usbtest-add-a-timeout-for-scatter-gather-tests.patch @@ -0,0 +1,72 @@ +From 32b36eeae6a859670d2939a7d6136cb5e9ed64f8 Mon Sep 17 00:00:00 2001 +From: Alan Stern +Date: Tue, 3 Jun 2014 11:11:34 -0400 +Subject: USB: usbtest: add a timeout for scatter-gather tests + +From: Alan Stern + +commit 32b36eeae6a859670d2939a7d6136cb5e9ed64f8 upstream. + +In usbtest, tests 5 - 8 use the scatter-gather library in usbcore +without any sort of timeout. If there's a problem in the gadget or +host controller being tested, the test can hang. + +This patch adds a 10-second timeout to the tests, so that they will +fail gracefully with an ETIMEDOUT error instead of hanging. + +Signed-off-by: Alan Stern +Reported-by: Huang Rui +Tested-by: Huang Rui +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/misc/usbtest.c | 16 +++++++++++++++- + 1 file changed, 15 insertions(+), 1 deletion(-) + +--- a/drivers/usb/misc/usbtest.c ++++ b/drivers/usb/misc/usbtest.c +@@ -7,7 +7,7 @@ + #include + #include + #include +- ++#include + #include + + +@@ -462,6 +462,14 @@ alloc_sglist(int nents, int max, int var + return sg; + } + ++static void sg_timeout(unsigned long _req) ++{ ++ struct usb_sg_request *req = (struct usb_sg_request *) _req; ++ ++ req->status = -ETIMEDOUT; ++ usb_sg_cancel(req); ++} ++ + static int perform_sglist( + struct usbtest_dev *tdev, + unsigned iterations, +@@ -473,6 +481,9 @@ static int perform_sglist( + { + struct usb_device *udev = testdev_to_usbdev(tdev); + int retval = 0; ++ struct timer_list sg_timer; ++ ++ setup_timer_on_stack(&sg_timer, sg_timeout, (unsigned long) req); + + while (retval == 0 && iterations-- > 0) { + retval = usb_sg_init(req, udev, pipe, +@@ -483,7 +494,10 @@ static int perform_sglist( + + if (retval) + break; ++ mod_timer(&sg_timer, jiffies + ++ msecs_to_jiffies(SIMPLE_IO_TIMEOUT)); + usb_sg_wait(req); ++ del_timer_sync(&sg_timer); + retval = req->status; + + /* FIXME check resulting data pattern */ diff --git a/queue-3.4/usb-usbtest-fix-unlink-write-error-with-pattern-1.patch b/queue-3.4/usb-usbtest-fix-unlink-write-error-with-pattern-1.patch new file mode 100644 index 00000000000..47a70ed87eb --- /dev/null +++ b/queue-3.4/usb-usbtest-fix-unlink-write-error-with-pattern-1.patch @@ -0,0 +1,68 @@ +From e4d58f5dcb7d7be45df8def31881ebfae99c75da Mon Sep 17 00:00:00 2001 +From: Huang Rui +Date: Mon, 26 May 2014 10:55:36 +0800 +Subject: usb: usbtest: fix unlink write error with pattern 1 + +From: Huang Rui + +commit e4d58f5dcb7d7be45df8def31881ebfae99c75da upstream. + +TEST 12 and TEST 24 unlinks the URB write request for N times. When +host and gadget both initialize pattern 1 (mod 63) data series to +transfer, the gadget side will complain the wrong data which is not +expected. Because in host side, usbtest doesn't fill the data buffer +as mod 63 and this patch fixed it. + +[20285.488974] dwc3 dwc3.0.auto: ep1out-bulk: Transfer Not Ready +[20285.489181] dwc3 dwc3.0.auto: ep1out-bulk: reason Transfer Not Active +[20285.489423] dwc3 dwc3.0.auto: ep1out-bulk: req ffff8800aa6cb480 dma aeb50800 length 512 last +[20285.489727] dwc3 dwc3.0.auto: ep1out-bulk: cmd 'Start Transfer' params 00000000 a9eaf000 00000000 +[20285.490055] dwc3 dwc3.0.auto: Command Complete --> 0 +[20285.490281] dwc3 dwc3.0.auto: ep1out-bulk: Transfer Not Ready +[20285.490492] dwc3 dwc3.0.auto: ep1out-bulk: reason Transfer Active +[20285.490713] dwc3 dwc3.0.auto: ep1out-bulk: endpoint busy +[20285.490909] dwc3 dwc3.0.auto: ep1out-bulk: Transfer Complete +[20285.491117] dwc3 dwc3.0.auto: request ffff8800aa6cb480 from ep1out-bulk completed 512/512 ===> 0 +[20285.491431] zero gadget: bad OUT byte, buf[1] = 0 +[20285.491605] dwc3 dwc3.0.auto: ep1out-bulk: cmd 'Set Stall' params 00000000 00000000 00000000 +[20285.491915] dwc3 dwc3.0.auto: Command Complete --> 0 +[20285.492099] dwc3 dwc3.0.auto: queing request ffff8800aa6cb480 to ep1out-bulk length 512 +[20285.492387] dwc3 dwc3.0.auto: ep1out-bulk: Transfer Not Ready +[20285.492595] dwc3 dwc3.0.auto: ep1out-bulk: reason Transfer Not Active +[20285.492830] dwc3 dwc3.0.auto: ep1out-bulk: req ffff8800aa6cb480 dma aeb51000 length 512 last +[20285.493135] dwc3 dwc3.0.auto: ep1out-bulk: cmd 'Start Transfer' params 00000000 a9eaf000 00000000 +[20285.493465] dwc3 dwc3.0.auto: Command Complete --> 0 + +Signed-off-by: Huang Rui +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/misc/usbtest.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +--- a/drivers/usb/misc/usbtest.c ++++ b/drivers/usb/misc/usbtest.c +@@ -1135,6 +1135,11 @@ static int unlink1(struct usbtest_dev *d + urb->context = &completion; + urb->complete = unlink1_callback; + ++ if (usb_pipeout(urb->pipe)) { ++ simple_fill_buf(urb); ++ urb->transfer_flags |= URB_ZERO_PACKET; ++ } ++ + /* keep the endpoint busy. there are lots of hc/hcd-internal + * states, and testing should get to all of them over time. + * +@@ -1265,6 +1270,11 @@ static int unlink_queued(struct usbtest_ + unlink_queued_callback, &ctx); + ctx.urbs[i]->transfer_dma = buf_dma; + ctx.urbs[i]->transfer_flags = URB_NO_TRANSFER_DMA_MAP; ++ ++ if (usb_pipeout(ctx.urbs[i]->pipe)) { ++ simple_fill_buf(ctx.urbs[i]); ++ ctx.urbs[i]->transfer_flags |= URB_ZERO_PACKET; ++ } + } + + /* Submit all the URBs and then unlink URBs num - 4 and num - 2. */ -- 2.47.3