From: Greg Kroah-Hartman Date: Mon, 27 Apr 2020 18:29:16 +0000 (+0200) Subject: 4.14-stable patches X-Git-Tag: v4.19.119~13 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=09b220e13ac55b4a11de02c93be1d8318e8b6d55;p=thirdparty%2Fkernel%2Fstable-queue.git 4.14-stable patches added patches: arm-imx-provide-v7_cpu_resume-only-on-arm_cpu_suspend-y.patch cdc-acm-close-race-betrween-suspend-and-acm_softint.patch cdc-acm-introduce-a-cool-down.patch powerpc-setup_64-set-cache-line-size-based-on-cache-block-size.patch serial-sh-sci-make-sure-status-register-scxsr-is-read-in-correct-sequence.patch staging-comedi-dt2815-fix-writing-hi-byte-of-analog-output.patch staging-comedi-fix-comedi_device-refcnt-leak-in-comedi_open.patch staging-vt6656-don-t-set-rcr_multicast-or-rcr_broadcast-by-default.patch staging-vt6656-fix-calling-conditions-of-vnt_set_bss_mode.patch staging-vt6656-fix-drivers-tbtt-timing-counter.patch staging-vt6656-fix-pairwise-key-entry-save.patch staging-vt6656-power-save-stop-wake_up_count-wrap-around.patch uas-fix-deadlock-in-error-handling-and-pm-flushing-work.patch uas-no-use-logging-any-details-in-case-of-enodev.patch usb-f_fs-clear-os-extended-descriptor-counts-to-zero-in-ffs_data_reset.patch vt-don-t-hardcode-the-mem-allocation-upper-bound.patch --- diff --git a/queue-4.14/arm-imx-provide-v7_cpu_resume-only-on-arm_cpu_suspend-y.patch b/queue-4.14/arm-imx-provide-v7_cpu_resume-only-on-arm_cpu_suspend-y.patch new file mode 100644 index 00000000000..f41461e2202 --- /dev/null +++ b/queue-4.14/arm-imx-provide-v7_cpu_resume-only-on-arm_cpu_suspend-y.patch @@ -0,0 +1,46 @@ +From f1baca8896ae18e12c45552a4c4ae2086aa7e02c Mon Sep 17 00:00:00 2001 +From: Ahmad Fatoum +Date: Mon, 23 Mar 2020 09:19:33 +0100 +Subject: ARM: imx: provide v7_cpu_resume() only on ARM_CPU_SUSPEND=y + +From: Ahmad Fatoum + +commit f1baca8896ae18e12c45552a4c4ae2086aa7e02c upstream. + +512a928affd5 ("ARM: imx: build v7_cpu_resume() unconditionally") +introduced an unintended linker error for i.MX6 configurations that have +ARM_CPU_SUSPEND=n which can happen if neither CONFIG_PM, CONFIG_CPU_IDLE, +nor ARM_PSCI_FW are selected. + +Fix this by having v7_cpu_resume() compiled only when cpu_resume() it +calls is available as well. + +The C declaration for the function remains unguarded to avoid future code +inadvertently using a stub and introducing a regression to the bug the +original commit fixed. + +Cc: +Fixes: 512a928affd5 ("ARM: imx: build v7_cpu_resume() unconditionally") +Reported-by: Clemens Gruber +Signed-off-by: Ahmad Fatoum +Tested-by: Roland Hieber +Signed-off-by: Arnd Bergmann +Signed-off-by: Greg Kroah-Hartman + +--- + arch/arm/mach-imx/Makefile | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/arch/arm/mach-imx/Makefile ++++ b/arch/arm/mach-imx/Makefile +@@ -87,8 +87,10 @@ AFLAGS_suspend-imx6.o :=-Wa,-march=armv7 + obj-$(CONFIG_SOC_IMX6) += suspend-imx6.o + obj-$(CONFIG_SOC_IMX53) += suspend-imx53.o + endif ++ifeq ($(CONFIG_ARM_CPU_SUSPEND),y) + AFLAGS_resume-imx6.o :=-Wa,-march=armv7-a + obj-$(CONFIG_SOC_IMX6) += resume-imx6.o ++endif + obj-$(CONFIG_SOC_IMX6) += pm-imx6.o + + obj-$(CONFIG_SOC_IMX1) += mach-imx1.o diff --git a/queue-4.14/cdc-acm-close-race-betrween-suspend-and-acm_softint.patch b/queue-4.14/cdc-acm-close-race-betrween-suspend-and-acm_softint.patch new file mode 100644 index 00000000000..76ae1c8226d --- /dev/null +++ b/queue-4.14/cdc-acm-close-race-betrween-suspend-and-acm_softint.patch @@ -0,0 +1,44 @@ +From 0afccd7601514c4b83d8cc58c740089cc447051d Mon Sep 17 00:00:00 2001 +From: Oliver Neukum +Date: Wed, 15 Apr 2020 17:13:57 +0200 +Subject: cdc-acm: close race betrween suspend() and acm_softint + +From: Oliver Neukum + +commit 0afccd7601514c4b83d8cc58c740089cc447051d upstream. + +Suspend increments a counter, then kills the URBs, +then kills the scheduled work. The scheduled work, however, +may reschedule the URBs. Fix this by having the work +check the counter. + +Signed-off-by: Oliver Neukum +Cc: stable +Tested-by: Jonas Karlsson +Link: https://lore.kernel.org/r/20200415151358.32664-1-oneukum@suse.com +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/class/cdc-acm.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/drivers/usb/class/cdc-acm.c ++++ b/drivers/usb/class/cdc-acm.c +@@ -575,14 +575,14 @@ static void acm_softint(struct work_stru + struct acm *acm = container_of(work, struct acm, work); + + if (test_bit(EVENT_RX_STALL, &acm->flags)) { +- if (!(usb_autopm_get_interface(acm->data))) { ++ smp_mb(); /* against acm_suspend() */ ++ if (!acm->susp_count) { + for (i = 0; i < acm->rx_buflimit; i++) + usb_kill_urb(acm->read_urbs[i]); + usb_clear_halt(acm->dev, acm->in); + acm_submit_read_urbs(acm, GFP_KERNEL); +- usb_autopm_put_interface(acm->data); ++ clear_bit(EVENT_RX_STALL, &acm->flags); + } +- clear_bit(EVENT_RX_STALL, &acm->flags); + } + + if (test_and_clear_bit(EVENT_TTY_WAKEUP, &acm->flags)) diff --git a/queue-4.14/cdc-acm-introduce-a-cool-down.patch b/queue-4.14/cdc-acm-introduce-a-cool-down.patch new file mode 100644 index 00000000000..21eb71059ac --- /dev/null +++ b/queue-4.14/cdc-acm-introduce-a-cool-down.patch @@ -0,0 +1,137 @@ +From a4e7279cd1d19f48f0af2a10ed020febaa9ac092 Mon Sep 17 00:00:00 2001 +From: Oliver Neukum +Date: Wed, 15 Apr 2020 17:13:58 +0200 +Subject: cdc-acm: introduce a cool down + +From: Oliver Neukum + +commit a4e7279cd1d19f48f0af2a10ed020febaa9ac092 upstream. + +Immediate submission in case of a babbling device can lead +to a busy loop. Introducing a delayed work. + +Signed-off-by: Oliver Neukum +Cc: stable +Tested-by: Jonas Karlsson +Link: https://lore.kernel.org/r/20200415151358.32664-2-oneukum@suse.com +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/class/cdc-acm.c | 30 ++++++++++++++++++++++++++++-- + drivers/usb/class/cdc-acm.h | 5 ++++- + 2 files changed, 32 insertions(+), 3 deletions(-) + +--- a/drivers/usb/class/cdc-acm.c ++++ b/drivers/usb/class/cdc-acm.c +@@ -424,9 +424,12 @@ static void acm_ctrl_irq(struct urb *urb + + exit: + retval = usb_submit_urb(urb, GFP_ATOMIC); +- if (retval && retval != -EPERM) ++ if (retval && retval != -EPERM && retval != -ENODEV) + dev_err(&acm->control->dev, + "%s - usb_submit_urb failed: %d\n", __func__, retval); ++ else ++ dev_vdbg(&acm->control->dev, ++ "control resubmission terminated %d\n", retval); + } + + static int acm_submit_read_urb(struct acm *acm, int index, gfp_t mem_flags) +@@ -442,6 +445,8 @@ static int acm_submit_read_urb(struct ac + dev_err(&acm->data->dev, + "urb %d failed submission with %d\n", + index, res); ++ } else { ++ dev_vdbg(&acm->data->dev, "intended failure %d\n", res); + } + set_bit(index, &acm->read_urbs_free); + return res; +@@ -484,6 +489,7 @@ static void acm_read_bulk_callback(struc + int status = urb->status; + bool stopped = false; + bool stalled = false; ++ bool cooldown = false; + + dev_vdbg(&acm->data->dev, "got urb %d, len %d, status %d\n", + rb->index, urb->actual_length, status); +@@ -510,6 +516,14 @@ static void acm_read_bulk_callback(struc + __func__, status); + stopped = true; + break; ++ case -EOVERFLOW: ++ case -EPROTO: ++ dev_dbg(&acm->data->dev, ++ "%s - cooling babbling device\n", __func__); ++ usb_mark_last_busy(acm->dev); ++ set_bit(rb->index, &acm->urbs_in_error_delay); ++ cooldown = true; ++ break; + default: + dev_dbg(&acm->data->dev, + "%s - nonzero urb status received: %d\n", +@@ -531,9 +545,11 @@ static void acm_read_bulk_callback(struc + */ + smp_mb__after_atomic(); + +- if (stopped || stalled) { ++ if (stopped || stalled || cooldown) { + if (stalled) + schedule_work(&acm->work); ++ else if (cooldown) ++ schedule_delayed_work(&acm->dwork, HZ / 2); + return; + } + +@@ -585,6 +601,12 @@ static void acm_softint(struct work_stru + } + } + ++ if (test_and_clear_bit(ACM_ERROR_DELAY, &acm->flags)) { ++ for (i = 0; i < ACM_NR; i++) ++ if (test_and_clear_bit(i, &acm->urbs_in_error_delay)) ++ acm_submit_read_urb(acm, i, GFP_NOIO); ++ } ++ + if (test_and_clear_bit(EVENT_TTY_WAKEUP, &acm->flags)) + tty_port_tty_wakeup(&acm->port); + } +@@ -1374,6 +1396,7 @@ made_compressed_probe: + acm->readsize = readsize; + acm->rx_buflimit = num_rx_buf; + INIT_WORK(&acm->work, acm_softint); ++ INIT_DELAYED_WORK(&acm->dwork, acm_softint); + init_waitqueue_head(&acm->wioctl); + spin_lock_init(&acm->write_lock); + spin_lock_init(&acm->read_lock); +@@ -1587,6 +1610,7 @@ static void acm_disconnect(struct usb_in + + acm_kill_urbs(acm); + cancel_work_sync(&acm->work); ++ cancel_delayed_work_sync(&acm->dwork); + + tty_unregister_device(acm_tty_driver, acm->minor); + +@@ -1629,6 +1653,8 @@ static int acm_suspend(struct usb_interf + + acm_kill_urbs(acm); + cancel_work_sync(&acm->work); ++ cancel_delayed_work_sync(&acm->dwork); ++ acm->urbs_in_error_delay = 0; + + return 0; + } +--- a/drivers/usb/class/cdc-acm.h ++++ b/drivers/usb/class/cdc-acm.h +@@ -108,8 +108,11 @@ struct acm { + unsigned long flags; + # define EVENT_TTY_WAKEUP 0 + # define EVENT_RX_STALL 1 ++# define ACM_ERROR_DELAY 3 ++ unsigned long urbs_in_error_delay; /* these need to be restarted after a delay */ + struct usb_cdc_line_coding line; /* bits, stop, parity */ +- struct work_struct work; /* work queue entry for line discipline waking up */ ++ struct work_struct work; /* work queue entry for various purposes*/ ++ struct delayed_work dwork; /* for cool downs needed in error recovery */ + unsigned int ctrlin; /* input control lines (DCD, DSR, RI, break, overruns) */ + unsigned int ctrlout; /* output control lines (DTR, RTS) */ + struct async_icount iocount; /* counters for control line changes */ diff --git a/queue-4.14/powerpc-setup_64-set-cache-line-size-based-on-cache-block-size.patch b/queue-4.14/powerpc-setup_64-set-cache-line-size-based-on-cache-block-size.patch new file mode 100644 index 00000000000..767559f666c --- /dev/null +++ b/queue-4.14/powerpc-setup_64-set-cache-line-size-based-on-cache-block-size.patch @@ -0,0 +1,53 @@ +From 94c0b013c98583614e1ad911e8795ca36da34a85 Mon Sep 17 00:00:00 2001 +From: Chris Packham +Date: Fri, 17 Apr 2020 10:19:08 +1200 +Subject: powerpc/setup_64: Set cache-line-size based on cache-block-size + +From: Chris Packham + +commit 94c0b013c98583614e1ad911e8795ca36da34a85 upstream. + +If {i,d}-cache-block-size is set and {i,d}-cache-line-size is not, use +the block-size value for both. Per the devicetree spec cache-line-size +is only needed if it differs from the block size. + +Originally the code would fallback from block size to line size. An +error message was printed if both properties were missing. + +Later the code was refactored to use clearer names and logic but it +inadvertently made line size a required property, meaning on systems +without a line size property we fall back to the default from the +cputable. + +On powernv (OPAL) platforms, since the introduction of device tree CPU +features (5a61ef74f269 ("powerpc/64s: Support new device tree binding +for discovering CPU features")), that has led to the wrong value being +used, as the fallback value is incorrect for Power8/Power9 CPUs. + +The incorrect values flow through to the VDSO and also to the sysconf +values, SC_LEVEL1_ICACHE_LINESIZE etc. + +Fixes: bd067f83b084 ("powerpc/64: Fix naming of cache block vs. cache line") +Cc: stable@vger.kernel.org # v4.11+ +Signed-off-by: Chris Packham +Reported-by: Qian Cai +[mpe: Add even more detail to change log] +Signed-off-by: Michael Ellerman +Link: https://lore.kernel.org/r/20200416221908.7886-1-chris.packham@alliedtelesis.co.nz +Signed-off-by: Greg Kroah-Hartman + +--- + arch/powerpc/kernel/setup_64.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/arch/powerpc/kernel/setup_64.c ++++ b/arch/powerpc/kernel/setup_64.c +@@ -466,6 +466,8 @@ static bool __init parse_cache_info(stru + lsizep = of_get_property(np, propnames[3], NULL); + if (bsizep == NULL) + bsizep = lsizep; ++ if (lsizep == NULL) ++ lsizep = bsizep; + if (lsizep != NULL) + lsize = be32_to_cpu(*lsizep); + if (bsizep != NULL) diff --git a/queue-4.14/serial-sh-sci-make-sure-status-register-scxsr-is-read-in-correct-sequence.patch b/queue-4.14/serial-sh-sci-make-sure-status-register-scxsr-is-read-in-correct-sequence.patch new file mode 100644 index 00000000000..2c52dd5f9bd --- /dev/null +++ b/queue-4.14/serial-sh-sci-make-sure-status-register-scxsr-is-read-in-correct-sequence.patch @@ -0,0 +1,51 @@ +From 3dc4db3662366306e54ddcbda4804acb1258e4ba Mon Sep 17 00:00:00 2001 +From: Kazuhiro Fujita +Date: Fri, 27 Mar 2020 18:17:28 +0000 +Subject: serial: sh-sci: Make sure status register SCxSR is read in correct sequence + +From: Kazuhiro Fujita + +commit 3dc4db3662366306e54ddcbda4804acb1258e4ba upstream. + +For SCIF and HSCIF interfaces the SCxSR register holds the status of +data that is to be read next from SCxRDR register, But where as for +SCIFA and SCIFB interfaces SCxSR register holds status of data that is +previously read from SCxRDR register. + +This patch makes sure the status register is read depending on the port +types so that errors are caught accordingly. + +Cc: +Signed-off-by: Kazuhiro Fujita +Signed-off-by: Hao Bui +Signed-off-by: KAZUMI HARADA +Signed-off-by: Lad Prabhakar +Tested-by: Geert Uytterhoeven +Link: https://lore.kernel.org/r/1585333048-31828-1-git-send-email-kazuhiro.fujita.jg@renesas.com +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/tty/serial/sh-sci.c | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +--- a/drivers/tty/serial/sh-sci.c ++++ b/drivers/tty/serial/sh-sci.c +@@ -841,9 +841,16 @@ static void sci_receive_chars(struct uar + tty_insert_flip_char(tport, c, TTY_NORMAL); + } else { + for (i = 0; i < count; i++) { +- char c = serial_port_in(port, SCxRDR); ++ char c; + +- status = serial_port_in(port, SCxSR); ++ if (port->type == PORT_SCIF || ++ port->type == PORT_HSCIF) { ++ status = serial_port_in(port, SCxSR); ++ c = serial_port_in(port, SCxRDR); ++ } else { ++ c = serial_port_in(port, SCxRDR); ++ status = serial_port_in(port, SCxSR); ++ } + if (uart_handle_sysrq_char(port, c)) { + count--; i--; + continue; diff --git a/queue-4.14/series b/queue-4.14/series index 139f04d4cd4..2060c9ba09d 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -64,3 +64,19 @@ usb-storage-add-unusual_devs-entry-for-jmicron-jms566.patch audit-check-the-length-of-userspace-generated-audit-records.patch asoc-dapm-fixup-dapm-kcontrol-widget.patch iwlwifi-pcie-actually-release-queue-memory-in-tvqm.patch +arm-imx-provide-v7_cpu_resume-only-on-arm_cpu_suspend-y.patch +powerpc-setup_64-set-cache-line-size-based-on-cache-block-size.patch +staging-comedi-dt2815-fix-writing-hi-byte-of-analog-output.patch +staging-comedi-fix-comedi_device-refcnt-leak-in-comedi_open.patch +vt-don-t-hardcode-the-mem-allocation-upper-bound.patch +staging-vt6656-don-t-set-rcr_multicast-or-rcr_broadcast-by-default.patch +staging-vt6656-fix-calling-conditions-of-vnt_set_bss_mode.patch +staging-vt6656-fix-drivers-tbtt-timing-counter.patch +staging-vt6656-fix-pairwise-key-entry-save.patch +staging-vt6656-power-save-stop-wake_up_count-wrap-around.patch +cdc-acm-close-race-betrween-suspend-and-acm_softint.patch +cdc-acm-introduce-a-cool-down.patch +uas-no-use-logging-any-details-in-case-of-enodev.patch +uas-fix-deadlock-in-error-handling-and-pm-flushing-work.patch +usb-f_fs-clear-os-extended-descriptor-counts-to-zero-in-ffs_data_reset.patch +serial-sh-sci-make-sure-status-register-scxsr-is-read-in-correct-sequence.patch diff --git a/queue-4.14/staging-comedi-dt2815-fix-writing-hi-byte-of-analog-output.patch b/queue-4.14/staging-comedi-dt2815-fix-writing-hi-byte-of-analog-output.patch new file mode 100644 index 00000000000..a087dc9d4f8 --- /dev/null +++ b/queue-4.14/staging-comedi-dt2815-fix-writing-hi-byte-of-analog-output.patch @@ -0,0 +1,62 @@ +From ed87d33ddbcd9a1c3b5ae87995da34e6f51a862c Mon Sep 17 00:00:00 2001 +From: Ian Abbott +Date: Mon, 6 Apr 2020 15:20:15 +0100 +Subject: staging: comedi: dt2815: fix writing hi byte of analog output + +From: Ian Abbott + +commit ed87d33ddbcd9a1c3b5ae87995da34e6f51a862c upstream. + +The DT2815 analog output command is 16 bits wide, consisting of the +12-bit sample value in bits 15 to 4, the channel number in bits 3 to 1, +and a voltage or current selector in bit 0. Both bytes of the 16-bit +command need to be written in turn to a single 8-bit data register. +However, the driver currently only writes the low 8-bits. It is broken +and appears to have always been broken. + +Electronic copies of the DT2815 User's Manual seem impossible to find +online, but looking at the source code, a best guess for the sequence +the driver intended to use to write the analog output command is as +follows: + +1. Wait for the status register to read 0x00. +2. Write the low byte of the command to the data register. +3. Wait for the status register to read 0x80. +4. Write the high byte of the command to the data register. + +Step 4 is missing from the driver. Add step 4 to (hopefully) fix the +driver. + +Also add a "FIXME" comment about setting bit 0 of the low byte of the +command. Supposedly, it is used to choose between voltage output and +current output, but the current driver always sets it to 1. + +Signed-off-by: Ian Abbott +Cc: stable +Link: https://lore.kernel.org/r/20200406142015.126982-1-abbotti@mev.co.uk +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/staging/comedi/drivers/dt2815.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/staging/comedi/drivers/dt2815.c ++++ b/drivers/staging/comedi/drivers/dt2815.c +@@ -101,6 +101,7 @@ static int dt2815_ao_insn(struct comedi_ + int ret; + + for (i = 0; i < insn->n; i++) { ++ /* FIXME: lo bit 0 chooses voltage output or current output */ + lo = ((data[i] & 0x0f) << 4) | (chan << 1) | 0x01; + hi = (data[i] & 0xff0) >> 4; + +@@ -114,6 +115,8 @@ static int dt2815_ao_insn(struct comedi_ + if (ret) + return ret; + ++ outb(hi, dev->iobase + DT2815_DATA); ++ + devpriv->ao_readback[chan] = data[i]; + } + return i; diff --git a/queue-4.14/staging-comedi-fix-comedi_device-refcnt-leak-in-comedi_open.patch b/queue-4.14/staging-comedi-fix-comedi_device-refcnt-leak-in-comedi_open.patch new file mode 100644 index 00000000000..879a0590aa6 --- /dev/null +++ b/queue-4.14/staging-comedi-fix-comedi_device-refcnt-leak-in-comedi_open.patch @@ -0,0 +1,49 @@ +From 332e0e17ad49e084b7db670ef43b5eb59abd9e34 Mon Sep 17 00:00:00 2001 +From: Xiyu Yang +Date: Mon, 20 Apr 2020 13:44:16 +0800 +Subject: staging: comedi: Fix comedi_device refcnt leak in comedi_open + +From: Xiyu Yang + +commit 332e0e17ad49e084b7db670ef43b5eb59abd9e34 upstream. + +comedi_open() invokes comedi_dev_get_from_minor(), which returns a +reference of the COMEDI device to "dev" with increased refcount. + +When comedi_open() returns, "dev" becomes invalid, so the refcount +should be decreased to keep refcount balanced. + +The reference counting issue happens in one exception handling path of +comedi_open(). When "cfp" allocation is failed, the refcnt increased by +comedi_dev_get_from_minor() is not decreased, causing a refcnt leak. + +Fix this issue by calling comedi_dev_put() on this error path when "cfp" +allocation is failed. + +Fixes: 20f083c07565 ("staging: comedi: prepare support for per-file read and write subdevices") +Signed-off-by: Xiyu Yang +Cc: stable +Signed-off-by: Xin Tan +Signed-off-by: Ian Abbott +Link: https://lore.kernel.org/r/1587361459-83622-1-git-send-email-xiyuyang19@fudan.edu.cn +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/staging/comedi/comedi_fops.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/drivers/staging/comedi/comedi_fops.c ++++ b/drivers/staging/comedi/comedi_fops.c +@@ -2603,8 +2603,10 @@ static int comedi_open(struct inode *ino + } + + cfp = kzalloc(sizeof(*cfp), GFP_KERNEL); +- if (!cfp) ++ if (!cfp) { ++ comedi_dev_put(dev); + return -ENOMEM; ++ } + + cfp->dev = dev; + diff --git a/queue-4.14/staging-vt6656-don-t-set-rcr_multicast-or-rcr_broadcast-by-default.patch b/queue-4.14/staging-vt6656-don-t-set-rcr_multicast-or-rcr_broadcast-by-default.patch new file mode 100644 index 00000000000..f6159e8a449 --- /dev/null +++ b/queue-4.14/staging-vt6656-don-t-set-rcr_multicast-or-rcr_broadcast-by-default.patch @@ -0,0 +1,45 @@ +From 0f8240bfc070033a4823b19883efd3d38c7735cc Mon Sep 17 00:00:00 2001 +From: Malcolm Priestley +Date: Sat, 18 Apr 2020 17:24:50 +0100 +Subject: staging: vt6656: Don't set RCR_MULTICAST or RCR_BROADCAST by default. + +From: Malcolm Priestley + +commit 0f8240bfc070033a4823b19883efd3d38c7735cc upstream. + +mac80211/users control whether multicast is on or off don't enable it by default. + +Fixes an issue when multicast/broadcast is always on allowing other beacons through +in power save. + +Fixes: db8f37fa3355 ("staging: vt6656: mac80211 conversion: main_usb add functions...") +Cc: stable +Signed-off-by: Malcolm Priestley +Link: https://lore.kernel.org/r/2c24c33d-68c4-f343-bd62-105422418eac@gmail.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/staging/vt6656/main_usb.c | 8 ++------ + 1 file changed, 2 insertions(+), 6 deletions(-) + +--- a/drivers/staging/vt6656/main_usb.c ++++ b/drivers/staging/vt6656/main_usb.c +@@ -779,15 +779,11 @@ static void vnt_configure(struct ieee802 + { + struct vnt_private *priv = hw->priv; + u8 rx_mode = 0; +- int rc; + + *total_flags &= FIF_ALLMULTI | FIF_OTHER_BSS | FIF_BCN_PRBRESP_PROMISC; + +- rc = vnt_control_in(priv, MESSAGE_TYPE_READ, MAC_REG_RCR, +- MESSAGE_REQUEST_MACREG, sizeof(u8), &rx_mode); +- +- if (!rc) +- rx_mode = RCR_MULTICAST | RCR_BROADCAST; ++ vnt_control_in(priv, MESSAGE_TYPE_READ, MAC_REG_RCR, ++ MESSAGE_REQUEST_MACREG, sizeof(u8), &rx_mode); + + dev_dbg(&priv->usb->dev, "rx mode in = %x\n", rx_mode); + diff --git a/queue-4.14/staging-vt6656-fix-calling-conditions-of-vnt_set_bss_mode.patch b/queue-4.14/staging-vt6656-fix-calling-conditions-of-vnt_set_bss_mode.patch new file mode 100644 index 00000000000..b0aae10ae20 --- /dev/null +++ b/queue-4.14/staging-vt6656-fix-calling-conditions-of-vnt_set_bss_mode.patch @@ -0,0 +1,61 @@ +From 664ba5180234593b4b8517530e8198bf2f7359e2 Mon Sep 17 00:00:00 2001 +From: Malcolm Priestley +Date: Sat, 18 Apr 2020 18:37:18 +0100 +Subject: staging: vt6656: Fix calling conditions of vnt_set_bss_mode + +From: Malcolm Priestley + +commit 664ba5180234593b4b8517530e8198bf2f7359e2 upstream. + +vnt_set_bss_mode needs to be called on all changes to BSS_CHANGED_BASIC_RATES, +BSS_CHANGED_ERP_PREAMBLE and BSS_CHANGED_ERP_SLOT + +Remove all other calls and vnt_update_ifs which is called in vnt_set_bss_mode. + +Fixes an issue that preamble mode is not being updated correctly. + +Fixes: c12603576e06 ("staging: vt6656: Only call vnt_set_bss_mode on basic rates change.") +Cc: stable +Signed-off-by: Malcolm Priestley +Link: https://lore.kernel.org/r/44110801-6234-50d8-c583-9388f04b486c@gmail.com +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/staging/vt6656/main_usb.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +--- a/drivers/staging/vt6656/main_usb.c ++++ b/drivers/staging/vt6656/main_usb.c +@@ -594,8 +594,6 @@ static int vnt_add_interface(struct ieee + + priv->op_mode = vif->type; + +- vnt_set_bss_mode(priv); +- + /* LED blink on TX */ + vnt_mac_set_led(priv, LEDSTS_STS, LEDSTS_INTER); + +@@ -682,7 +680,6 @@ static void vnt_bss_info_changed(struct + priv->basic_rates = conf->basic_rates; + + vnt_update_top_rates(priv); +- vnt_set_bss_mode(priv); + + dev_dbg(&priv->usb->dev, "basic rates %x\n", conf->basic_rates); + } +@@ -711,11 +708,14 @@ static void vnt_bss_info_changed(struct + priv->short_slot_time = false; + + vnt_set_short_slot_time(priv); +- vnt_update_ifs(priv); + vnt_set_vga_gain_offset(priv, priv->bb_vga[0]); + vnt_update_pre_ed_threshold(priv, false); + } + ++ if (changed & (BSS_CHANGED_BASIC_RATES | BSS_CHANGED_ERP_PREAMBLE | ++ BSS_CHANGED_ERP_SLOT)) ++ vnt_set_bss_mode(priv); ++ + if (changed & BSS_CHANGED_TXPOWER) + vnt_rf_setpower(priv, priv->current_rate, + conf->chandef.chan->hw_value); diff --git a/queue-4.14/staging-vt6656-fix-drivers-tbtt-timing-counter.patch b/queue-4.14/staging-vt6656-fix-drivers-tbtt-timing-counter.patch new file mode 100644 index 00000000000..611c8ad1277 --- /dev/null +++ b/queue-4.14/staging-vt6656-fix-drivers-tbtt-timing-counter.patch @@ -0,0 +1,45 @@ +From 09057742af98a39ebffa27fac4f889dc873132de Mon Sep 17 00:00:00 2001 +From: Malcolm Priestley +Date: Sat, 18 Apr 2020 17:43:24 +0100 +Subject: staging: vt6656: Fix drivers TBTT timing counter. + +From: Malcolm Priestley + +commit 09057742af98a39ebffa27fac4f889dc873132de upstream. + +The drivers TBTT counter is not synchronized with mac80211 timestamp. + +Reorder the functions and use vnt_update_next_tbtt to do the final +synchronize. + +Fixes: c15158797df6 ("staging: vt6656: implement TSF counter") +Cc: stable +Signed-off-by: Malcolm Priestley +Link: https://lore.kernel.org/r/375d0b25-e8bc-c8f7-9b10-6cc705d486ee@gmail.com +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/staging/vt6656/main_usb.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +--- a/drivers/staging/vt6656/main_usb.c ++++ b/drivers/staging/vt6656/main_usb.c +@@ -739,12 +739,15 @@ static void vnt_bss_info_changed(struct + vnt_mac_reg_bits_on(priv, MAC_REG_TFTCTL, + TFTCTL_TSFCNTREN); + +- vnt_adjust_tsf(priv, conf->beacon_rate->hw_value, +- conf->sync_tsf, priv->current_tsf); +- + vnt_mac_set_beacon_interval(priv, conf->beacon_int); + + vnt_reset_next_tbtt(priv, conf->beacon_int); ++ ++ vnt_adjust_tsf(priv, conf->beacon_rate->hw_value, ++ conf->sync_tsf, priv->current_tsf); ++ ++ vnt_update_next_tbtt(priv, ++ conf->sync_tsf, conf->beacon_int); + } else { + vnt_clear_current_tsf(priv); + diff --git a/queue-4.14/staging-vt6656-fix-pairwise-key-entry-save.patch b/queue-4.14/staging-vt6656-fix-pairwise-key-entry-save.patch new file mode 100644 index 00000000000..663f165578a --- /dev/null +++ b/queue-4.14/staging-vt6656-fix-pairwise-key-entry-save.patch @@ -0,0 +1,86 @@ +From 0b59f10b1d8fe8d50944f21f5d403df9303095a8 Mon Sep 17 00:00:00 2001 +From: Malcolm Priestley +Date: Sat, 18 Apr 2020 22:01:49 +0100 +Subject: staging: vt6656: Fix pairwise key entry save. + +From: Malcolm Priestley + +commit 0b59f10b1d8fe8d50944f21f5d403df9303095a8 upstream. + +The problem is that the group key was saved as VNT_KEY_DEFAULTKEY +was over written by the VNT_KEY_GROUP_ADDRESS index. + +mac80211 could not clear the mac_addr in the default key. + +The VNT_KEY_DEFAULTKEY is not necesscary so remove it and set as +VNT_KEY_GROUP_ADDRESS. + +mac80211 can clear any key using vnt_mac_disable_keyentry. + +Fixes: f9ef05ce13e4 ("staging: vt6656: Fix pairwise key for non station modes") +Cc: stable +Signed-off-by: Malcolm Priestley +Link: https://lore.kernel.org/r/da2f7e7f-1658-1320-6eee-0f55770ca391@gmail.com +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/staging/vt6656/key.c | 14 +++----------- + drivers/staging/vt6656/main_usb.c | 6 +++++- + 2 files changed, 8 insertions(+), 12 deletions(-) + +--- a/drivers/staging/vt6656/key.c ++++ b/drivers/staging/vt6656/key.c +@@ -91,9 +91,6 @@ static int vnt_set_keymode(struct ieee80 + case VNT_KEY_PAIRWISE: + key_mode |= mode; + key_inx = 4; +- /* Don't save entry for pairwise key for station mode */ +- if (priv->op_mode == NL80211_IFTYPE_STATION) +- clear_bit(entry, &priv->key_entry_inuse); + break; + default: + return -EINVAL; +@@ -117,7 +114,6 @@ static int vnt_set_keymode(struct ieee80 + int vnt_set_keys(struct ieee80211_hw *hw, struct ieee80211_sta *sta, + struct ieee80211_vif *vif, struct ieee80211_key_conf *key) + { +- struct ieee80211_bss_conf *conf = &vif->bss_conf; + struct vnt_private *priv = hw->priv; + u8 *mac_addr = NULL; + u8 key_dec_mode = 0; +@@ -159,16 +155,12 @@ int vnt_set_keys(struct ieee80211_hw *hw + key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; + } + +- if (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) { ++ if (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) + vnt_set_keymode(hw, mac_addr, key, VNT_KEY_PAIRWISE, + key_dec_mode, true); +- } else { +- vnt_set_keymode(hw, mac_addr, key, VNT_KEY_DEFAULTKEY, ++ else ++ vnt_set_keymode(hw, mac_addr, key, VNT_KEY_GROUP_ADDRESS, + key_dec_mode, true); + +- vnt_set_keymode(hw, (u8 *)conf->bssid, key, +- VNT_KEY_GROUP_ADDRESS, key_dec_mode, true); +- } +- + return 0; + } +--- a/drivers/staging/vt6656/main_usb.c ++++ b/drivers/staging/vt6656/main_usb.c +@@ -827,8 +827,12 @@ static int vnt_set_key(struct ieee80211_ + return -EOPNOTSUPP; + break; + case DISABLE_KEY: +- if (test_bit(key->hw_key_idx, &priv->key_entry_inuse)) ++ if (test_bit(key->hw_key_idx, &priv->key_entry_inuse)) { + clear_bit(key->hw_key_idx, &priv->key_entry_inuse); ++ ++ vnt_mac_disable_keyentry(priv, key->hw_key_idx); ++ } ++ + default: + break; + } diff --git a/queue-4.14/staging-vt6656-power-save-stop-wake_up_count-wrap-around.patch b/queue-4.14/staging-vt6656-power-save-stop-wake_up_count-wrap-around.patch new file mode 100644 index 00000000000..da0134bf2d7 --- /dev/null +++ b/queue-4.14/staging-vt6656-power-save-stop-wake_up_count-wrap-around.patch @@ -0,0 +1,37 @@ +From ea81c3486442f4643fc9825a2bb1b430b829bccd Mon Sep 17 00:00:00 2001 +From: Malcolm Priestley +Date: Tue, 14 Apr 2020 11:39:23 +0100 +Subject: staging: vt6656: Power save stop wake_up_count wrap around. + +From: Malcolm Priestley + +commit ea81c3486442f4643fc9825a2bb1b430b829bccd upstream. + +conf.listen_interval can sometimes be zero causing wake_up_count +to wrap around up to many beacons too late causing +CTRL-EVENT-BEACON-LOSS as in. + +wpa_supplicant[795]: message repeated 45 times: [..CTRL-EVENT-BEACON-LOSS ] + +Fixes: 43c93d9bf5e2 ("staging: vt6656: implement power saving code.") +Cc: stable +Signed-off-by: Malcolm Priestley +Link: https://lore.kernel.org/r/fce47bb5-7ca6-7671-5094-5c6107302f2b@gmail.com +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/staging/vt6656/int.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/staging/vt6656/int.c ++++ b/drivers/staging/vt6656/int.c +@@ -153,7 +153,8 @@ void vnt_int_process_data(struct vnt_pri + priv->wake_up_count = + priv->hw->conf.listen_interval; + +- --priv->wake_up_count; ++ if (priv->wake_up_count) ++ --priv->wake_up_count; + + /* Turn on wake up to listen next beacon */ + if (priv->wake_up_count == 1) diff --git a/queue-4.14/uas-fix-deadlock-in-error-handling-and-pm-flushing-work.patch b/queue-4.14/uas-fix-deadlock-in-error-handling-and-pm-flushing-work.patch new file mode 100644 index 00000000000..fe8f12ed8f4 --- /dev/null +++ b/queue-4.14/uas-fix-deadlock-in-error-handling-and-pm-flushing-work.patch @@ -0,0 +1,99 @@ +From f6cc6093a729ede1ff5658b493237c42b82ba107 Mon Sep 17 00:00:00 2001 +From: Oliver Neukum +Date: Wed, 15 Apr 2020 16:17:50 +0200 +Subject: UAS: fix deadlock in error handling and PM flushing work + +From: Oliver Neukum + +commit f6cc6093a729ede1ff5658b493237c42b82ba107 upstream. + +A SCSI error handler and block runtime PM must not allocate +memory with GFP_KERNEL. Furthermore they must not wait for +tasks allocating memory with GFP_KERNEL. +That means that they cannot share a workqueue with arbitrary tasks. + +Fix this for UAS using a private workqueue. + +Signed-off-by: Oliver Neukum +Fixes: f9dc024a2da1f ("uas: pre_reset and suspend: Fix a few races") +Cc: stable +Link: https://lore.kernel.org/r/20200415141750.811-2-oneukum@suse.com +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/storage/uas.c | 43 ++++++++++++++++++++++++++++++++++++++++--- + 1 file changed, 40 insertions(+), 3 deletions(-) + +--- a/drivers/usb/storage/uas.c ++++ b/drivers/usb/storage/uas.c +@@ -82,6 +82,19 @@ static void uas_free_streams(struct uas_ + static void uas_log_cmd_state(struct scsi_cmnd *cmnd, const char *prefix, + int status); + ++/* ++ * This driver needs its own workqueue, as we need to control memory allocation. ++ * ++ * In the course of error handling and power management uas_wait_for_pending_cmnds() ++ * needs to flush pending work items. In these contexts we cannot allocate memory ++ * by doing block IO as we would deadlock. For the same reason we cannot wait ++ * for anything allocating memory not heeding these constraints. ++ * ++ * So we have to control all work items that can be on the workqueue we flush. ++ * Hence we cannot share a queue and need our own. ++ */ ++static struct workqueue_struct *workqueue; ++ + static void uas_do_work(struct work_struct *work) + { + struct uas_dev_info *devinfo = +@@ -110,7 +123,7 @@ static void uas_do_work(struct work_stru + if (!err) + cmdinfo->state &= ~IS_IN_WORK_LIST; + else +- schedule_work(&devinfo->work); ++ queue_work(workqueue, &devinfo->work); + } + out: + spin_unlock_irqrestore(&devinfo->lock, flags); +@@ -135,7 +148,7 @@ static void uas_add_work(struct uas_cmd_ + + lockdep_assert_held(&devinfo->lock); + cmdinfo->state |= IS_IN_WORK_LIST; +- schedule_work(&devinfo->work); ++ queue_work(workqueue, &devinfo->work); + } + + static void uas_zap_pending(struct uas_dev_info *devinfo, int result) +@@ -1236,7 +1249,31 @@ static struct usb_driver uas_driver = { + .id_table = uas_usb_ids, + }; + +-module_usb_driver(uas_driver); ++static int __init uas_init(void) ++{ ++ int rv; ++ ++ workqueue = alloc_workqueue("uas", WQ_MEM_RECLAIM, 0); ++ if (!workqueue) ++ return -ENOMEM; ++ ++ rv = usb_register(&uas_driver); ++ if (rv) { ++ destroy_workqueue(workqueue); ++ return -ENOMEM; ++ } ++ ++ return 0; ++} ++ ++static void __exit uas_exit(void) ++{ ++ usb_deregister(&uas_driver); ++ destroy_workqueue(workqueue); ++} ++ ++module_init(uas_init); ++module_exit(uas_exit); + + MODULE_LICENSE("GPL"); + MODULE_AUTHOR( diff --git a/queue-4.14/uas-no-use-logging-any-details-in-case-of-enodev.patch b/queue-4.14/uas-no-use-logging-any-details-in-case-of-enodev.patch new file mode 100644 index 00000000000..116326dc20e --- /dev/null +++ b/queue-4.14/uas-no-use-logging-any-details-in-case-of-enodev.patch @@ -0,0 +1,33 @@ +From 5963dec98dc52d52476390485f07a29c30c6a582 Mon Sep 17 00:00:00 2001 +From: Oliver Neukum +Date: Wed, 15 Apr 2020 16:17:49 +0200 +Subject: UAS: no use logging any details in case of ENODEV + +From: Oliver Neukum + +commit 5963dec98dc52d52476390485f07a29c30c6a582 upstream. + +Once a device is gone, the internal state does not matter anymore. +There is no need to spam the logs. + +Signed-off-by: Oliver Neukum +Cc: stable +Fixes: 326349f824619 ("uas: add dead request list") +Link: https://lore.kernel.org/r/20200415141750.811-1-oneukum@suse.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/storage/uas.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/usb/storage/uas.c ++++ b/drivers/usb/storage/uas.c +@@ -191,6 +191,9 @@ static void uas_log_cmd_state(struct scs + struct uas_cmd_info *ci = (void *)&cmnd->SCp; + struct uas_cmd_info *cmdinfo = (void *)&cmnd->SCp; + ++ if (status == -ENODEV) /* too late */ ++ return; ++ + scmd_printk(KERN_INFO, cmnd, + "%s %d uas-tag %d inflight:%s%s%s%s%s%s%s%s%s%s%s%s ", + prefix, status, cmdinfo->uas_tag, diff --git a/queue-4.14/usb-f_fs-clear-os-extended-descriptor-counts-to-zero-in-ffs_data_reset.patch b/queue-4.14/usb-f_fs-clear-os-extended-descriptor-counts-to-zero-in-ffs_data_reset.patch new file mode 100644 index 00000000000..b21e2a2b18a --- /dev/null +++ b/queue-4.14/usb-f_fs-clear-os-extended-descriptor-counts-to-zero-in-ffs_data_reset.patch @@ -0,0 +1,46 @@ +From 1c2e54fbf1da5e5445a0ab132c862b02ccd8d230 Mon Sep 17 00:00:00 2001 +From: Udipto Goswami +Date: Thu, 2 Apr 2020 10:15:21 +0530 +Subject: usb: f_fs: Clear OS Extended descriptor counts to zero in ffs_data_reset() + +From: Udipto Goswami + +commit 1c2e54fbf1da5e5445a0ab132c862b02ccd8d230 upstream. + +For userspace functions using OS Descriptors, if a function also supplies +Extended Property descriptors currently the counts and lengths stored in +the ms_os_descs_ext_prop_{count,name_len,data_len} variables are not +getting reset to 0 during an unbind or when the epfiles are closed. If +the same function is re-bound and the descriptors are re-written, this +results in those count/length variables to monotonically increase +causing the VLA allocation in _ffs_func_bind() to grow larger and larger +at each bind/unbind cycle and eventually fail to allocate. + +Fix this by clearing the ms_os_descs_ext_prop count & lengths to 0 in +ffs_data_reset(). + +Fixes: f0175ab51993 ("usb: gadget: f_fs: OS descriptors support") +Cc: stable@vger.kernel.org +Signed-off-by: Udipto Goswami +Signed-off-by: Sriharsha Allenki +Reviewed-by: Manu Gautam +Link: https://lore.kernel.org/r/20200402044521.9312-1-sallenki@codeaurora.org +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/gadget/function/f_fs.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/drivers/usb/gadget/function/f_fs.c ++++ b/drivers/usb/gadget/function/f_fs.c +@@ -1727,6 +1727,10 @@ static void ffs_data_reset(struct ffs_da + ffs->state = FFS_READ_DESCRIPTORS; + ffs->setup_state = FFS_NO_SETUP; + ffs->flags = 0; ++ ++ ffs->ms_os_descs_ext_prop_count = 0; ++ ffs->ms_os_descs_ext_prop_name_len = 0; ++ ffs->ms_os_descs_ext_prop_data_len = 0; + } + + diff --git a/queue-4.14/vt-don-t-hardcode-the-mem-allocation-upper-bound.patch b/queue-4.14/vt-don-t-hardcode-the-mem-allocation-upper-bound.patch new file mode 100644 index 00000000000..5b29ec3b0d3 --- /dev/null +++ b/queue-4.14/vt-don-t-hardcode-the-mem-allocation-upper-bound.patch @@ -0,0 +1,40 @@ +From 2717769e204e83e65b8819c5e2ef3e5b6639b270 Mon Sep 17 00:00:00 2001 +From: Nicolas Pitre +Date: Sat, 28 Mar 2020 17:32:42 -0400 +Subject: vt: don't hardcode the mem allocation upper bound + +From: Nicolas Pitre + +commit 2717769e204e83e65b8819c5e2ef3e5b6639b270 upstream. + +The code in vc_do_resize() bounds the memory allocation size to avoid +exceeding MAX_ORDER down the kzalloc() call chain and generating a +runtime warning triggerable from user space. However, not only is it +unwise to use a literal value here, but MAX_ORDER may also be +configurable based on CONFIG_FORCE_MAX_ZONEORDER. +Let's use KMALLOC_MAX_SIZE instead. + +Note that prior commit bb1107f7c605 ("mm, slab: make sure that +KMALLOC_MAX_SIZE will fit into MAX_ORDER") the KMALLOC_MAX_SIZE value +could not be relied upon. + +Signed-off-by: Nicolas Pitre +Cc: # v4.10+ +Link: https://lore.kernel.org/r/nycvar.YSQ.7.76.2003281702410.2671@knanqh.ubzr +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/tty/vt/vt.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/tty/vt/vt.c ++++ b/drivers/tty/vt/vt.c +@@ -880,7 +880,7 @@ static int vc_do_resize(struct tty_struc + if (new_cols == vc->vc_cols && new_rows == vc->vc_rows) + return 0; + +- if (new_screen_size > (4 << 20)) ++ if (new_screen_size > KMALLOC_MAX_SIZE) + return -EINVAL; + newscreen = kzalloc(new_screen_size, GFP_USER); + if (!newscreen)