]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.14-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 6 Dec 2017 15:44:07 +0000 (16:44 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 6 Dec 2017 15:44:07 +0000 (16:44 +0100)
added patches:
android-binder-fix-transaction-leak.patch
mips-add-custom-serial.h-with-base_baud-override-for-generic-kernel.patch
serial-8250_early-only-set-divisor-if-valid-clk-baud.patch
usb-serial-option-add-quectel-bg96-id.patch
usb-serial-usb_debug-add-new-usb-device-id.patch

queue-4.14/android-binder-fix-transaction-leak.patch [new file with mode: 0644]
queue-4.14/mips-add-custom-serial.h-with-base_baud-override-for-generic-kernel.patch [new file with mode: 0644]
queue-4.14/serial-8250_early-only-set-divisor-if-valid-clk-baud.patch [new file with mode: 0644]
queue-4.14/series
queue-4.14/usb-serial-option-add-quectel-bg96-id.patch [new file with mode: 0644]
queue-4.14/usb-serial-usb_debug-add-new-usb-device-id.patch [new file with mode: 0644]

diff --git a/queue-4.14/android-binder-fix-transaction-leak.patch b/queue-4.14/android-binder-fix-transaction-leak.patch
new file mode 100644 (file)
index 0000000..4b8e767
--- /dev/null
@@ -0,0 +1,89 @@
+From fb2c445277e7b0b4ffe10de8114bad4eccaca948 Mon Sep 17 00:00:00 2001
+From: Martijn Coenen <maco@android.com>
+Date: Mon, 13 Nov 2017 10:06:08 +0100
+Subject: ANDROID: binder: fix transaction leak.
+
+From: Martijn Coenen <maco@android.com>
+
+commit fb2c445277e7b0b4ffe10de8114bad4eccaca948 upstream.
+
+If a call to put_user() fails, we failed to
+properly free a transaction and send a failed
+reply (if necessary).
+
+Signed-off-by: Martijn Coenen <maco@android.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/android/binder.c |   40 +++++++++++++++++++++++++++++++---------
+ 1 file changed, 31 insertions(+), 9 deletions(-)
+
+--- a/drivers/android/binder.c
++++ b/drivers/android/binder.c
+@@ -1948,6 +1948,26 @@ static void binder_send_failed_reply(str
+ }
+ /**
++ * binder_cleanup_transaction() - cleans up undelivered transaction
++ * @t:                transaction that needs to be cleaned up
++ * @reason:   reason the transaction wasn't delivered
++ * @error_code:       error to return to caller (if synchronous call)
++ */
++static void binder_cleanup_transaction(struct binder_transaction *t,
++                                     const char *reason,
++                                     uint32_t error_code)
++{
++      if (t->buffer->target_node && !(t->flags & TF_ONE_WAY)) {
++              binder_send_failed_reply(t, error_code);
++      } else {
++              binder_debug(BINDER_DEBUG_DEAD_TRANSACTION,
++                      "undelivered transaction %d, %s\n",
++                      t->debug_id, reason);
++              binder_free_transaction(t);
++      }
++}
++
++/**
+  * binder_validate_object() - checks for a valid metadata object in a buffer.
+  * @buffer:   binder_buffer that we're parsing.
+  * @offset:   offset in the buffer at which to validate an object.
+@@ -4015,12 +4035,20 @@ retry:
+               if (put_user(cmd, (uint32_t __user *)ptr)) {
+                       if (t_from)
+                               binder_thread_dec_tmpref(t_from);
++
++                      binder_cleanup_transaction(t, "put_user failed",
++                                                 BR_FAILED_REPLY);
++
+                       return -EFAULT;
+               }
+               ptr += sizeof(uint32_t);
+               if (copy_to_user(ptr, &tr, sizeof(tr))) {
+                       if (t_from)
+                               binder_thread_dec_tmpref(t_from);
++
++                      binder_cleanup_transaction(t, "copy_to_user failed",
++                                                 BR_FAILED_REPLY);
++
+                       return -EFAULT;
+               }
+               ptr += sizeof(tr);
+@@ -4090,15 +4118,9 @@ static void binder_release_work(struct b
+                       struct binder_transaction *t;
+                       t = container_of(w, struct binder_transaction, work);
+-                      if (t->buffer->target_node &&
+-                          !(t->flags & TF_ONE_WAY)) {
+-                              binder_send_failed_reply(t, BR_DEAD_REPLY);
+-                      } else {
+-                              binder_debug(BINDER_DEBUG_DEAD_TRANSACTION,
+-                                      "undelivered transaction %d\n",
+-                                      t->debug_id);
+-                              binder_free_transaction(t);
+-                      }
++
++                      binder_cleanup_transaction(t, "process died.",
++                                                 BR_DEAD_REPLY);
+               } break;
+               case BINDER_WORK_RETURN_ERROR: {
+                       struct binder_error *e = container_of(
diff --git a/queue-4.14/mips-add-custom-serial.h-with-base_baud-override-for-generic-kernel.patch b/queue-4.14/mips-add-custom-serial.h-with-base_baud-override-for-generic-kernel.patch
new file mode 100644 (file)
index 0000000..62b9a06
--- /dev/null
@@ -0,0 +1,73 @@
+From c8ec2041f549e7f2dee0c34d25381be6f7805f99 Mon Sep 17 00:00:00 2001
+From: Matt Redfearn <matt.redfearn@mips.com>
+Date: Tue, 28 Nov 2017 15:22:20 +0000
+Subject: MIPS: Add custom serial.h with BASE_BAUD override for generic kernel
+
+From: Matt Redfearn <matt.redfearn@mips.com>
+
+commit c8ec2041f549e7f2dee0c34d25381be6f7805f99 upstream.
+
+Add a custom serial.h header for MIPS, allowing platforms to override
+the asm-generic version if required.
+
+The generic platform uses this header to set BASE_BAUD to 0. The
+generic platform supports multiple boards, which may have different
+UART clocks. Also one of the boards supported is the Boston FPGA board,
+where the UART clock depends on the loaded FPGA bitfile. As such there
+is no way that the generic kernel can set a compile time default
+BASE_BAUD.
+
+Commit 31cb9a8575ca ("earlycon: initialise baud field of earlycon device
+structure") changed the behavior of of_setup_earlycon such that any baud
+rate set in the device tree is now set in the earlycon structure. The
+UART driver will then calculate a divisor based on BASE_BAUD and set it.
+With MIPS generic kernels this resulted in garbage output due to the
+incorrect uart clock rate being used to calculate a divisor. This
+commit, combined with "serial: 8250_early: Only set divisor if valid clk
+& baud" prevents the earlycon code setting a bad divisor and restores
+earlycon output.
+
+Fixes: 31cb9a8575ca ("earlycon: initialise baud field of earlycon device structure")
+Signed-off-by: Matt Redfearn <matt.redfearn@mips.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/mips/include/asm/Kbuild   |    1 -
+ arch/mips/include/asm/serial.h |   22 ++++++++++++++++++++++
+ 2 files changed, 22 insertions(+), 1 deletion(-)
+
+--- a/arch/mips/include/asm/Kbuild
++++ b/arch/mips/include/asm/Kbuild
+@@ -16,7 +16,6 @@ generic-y += qrwlock.h
+ generic-y += qspinlock.h
+ generic-y += sections.h
+ generic-y += segment.h
+-generic-y += serial.h
+ generic-y += trace_clock.h
+ generic-y += unaligned.h
+ generic-y += user.h
+--- /dev/null
++++ b/arch/mips/include/asm/serial.h
+@@ -0,0 +1,22 @@
++/*
++ * Copyright (C) 2017 MIPS Tech, LLC
++ *
++ * This program is free software; you can redistribute it and/or modify it
++ * under the terms of the GNU General Public License as published by the
++ * Free Software Foundation;  either version 2 of the  License, or (at your
++ * option) any later version.
++ */
++#ifndef __ASM__SERIAL_H
++#define __ASM__SERIAL_H
++
++#ifdef CONFIG_MIPS_GENERIC
++/*
++ * Generic kernels cannot know a correct value for all platforms at
++ * compile time. Set it to 0 to prevent 8250_early using it
++ */
++#define BASE_BAUD 0
++#else
++#include <asm-generic/serial.h>
++#endif
++
++#endif /* __ASM__SERIAL_H */
diff --git a/queue-4.14/serial-8250_early-only-set-divisor-if-valid-clk-baud.patch b/queue-4.14/serial-8250_early-only-set-divisor-if-valid-clk-baud.patch
new file mode 100644 (file)
index 0000000..e00805d
--- /dev/null
@@ -0,0 +1,55 @@
+From 0ff3ab701963a845d52337ded7eebf2d1a14fe00 Mon Sep 17 00:00:00 2001
+From: Matt Redfearn <matt.redfearn@mips.com>
+Date: Wed, 22 Nov 2017 09:57:28 +0000
+Subject: serial: 8250_early: Only set divisor if valid clk & baud
+
+From: Matt Redfearn <matt.redfearn@mips.com>
+
+commit 0ff3ab701963a845d52337ded7eebf2d1a14fe00 upstream.
+
+If either uartclk or baud are 0, avoid calculating and setting a divisor
+based on them since the output will almost certainly be garbage.
+
+This also allows platforms such as the MIPS generic kernel, which has no
+way to know a valid BASE_BASE for the board it is actually booted on at
+compile time, to set BASE_BAUD to 0 and avoid early_8250 setting a bad
+divisor.
+
+This fixes a regression caused by commit 31cb9a8575ca ("earlycon:
+initialise baud field of earlycon device structure"), which changed the
+behavior of of_setup_earlycon such that it sets a baud rate in the
+earlycon structure where previously it was left as 0. All boards
+supported by the MIPS generic kernel started outputting garbage from the
+boot console due to an incorrect divisor being set.
+
+Fixes: 31cb9a8575ca ("earlycon: initialise baud field of earlycon device structure")
+Signed-off-by: Matt Redfearn <matt.redfearn@mips.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/tty/serial/8250/8250_early.c |   14 ++++++++------
+ 1 file changed, 8 insertions(+), 6 deletions(-)
+
+--- a/drivers/tty/serial/8250/8250_early.c
++++ b/drivers/tty/serial/8250/8250_early.c
+@@ -125,12 +125,14 @@ static void __init init_port(struct earl
+       serial8250_early_out(port, UART_FCR, 0);        /* no fifo */
+       serial8250_early_out(port, UART_MCR, 0x3);      /* DTR + RTS */
+-      divisor = DIV_ROUND_CLOSEST(port->uartclk, 16 * device->baud);
+-      c = serial8250_early_in(port, UART_LCR);
+-      serial8250_early_out(port, UART_LCR, c | UART_LCR_DLAB);
+-      serial8250_early_out(port, UART_DLL, divisor & 0xff);
+-      serial8250_early_out(port, UART_DLM, (divisor >> 8) & 0xff);
+-      serial8250_early_out(port, UART_LCR, c & ~UART_LCR_DLAB);
++      if (port->uartclk && device->baud) {
++              divisor = DIV_ROUND_CLOSEST(port->uartclk, 16 * device->baud);
++              c = serial8250_early_in(port, UART_LCR);
++              serial8250_early_out(port, UART_LCR, c | UART_LCR_DLAB);
++              serial8250_early_out(port, UART_DLL, divisor & 0xff);
++              serial8250_early_out(port, UART_DLM, (divisor >> 8) & 0xff);
++              serial8250_early_out(port, UART_LCR, c & ~UART_LCR_DLAB);
++      }
+ }
+ int __init early_serial8250_setup(struct earlycon_device *device,
index 003c915087989bf9cb770aab8649cceedc538118..afe27f91c6ed7f43c433b3d36792ac8d02df5ad7 100644 (file)
@@ -7,3 +7,8 @@ usbip-fix-usb-device-hang-due-to-wrong-enabling-of-scatter-gather.patch
 uas-always-apply-us_fl_no_ata_1x-quirk-to-seagate-devices.patch
 usb-quirks-add-no-lpm-quirk-for-ky-688-usb-3.1-type-c-hub.patch
 serial-8250_pci-add-amazon-pci-serial-device-id.patch
+android-binder-fix-transaction-leak.patch
+usb-serial-option-add-quectel-bg96-id.patch
+usb-serial-usb_debug-add-new-usb-device-id.patch
+serial-8250_early-only-set-divisor-if-valid-clk-baud.patch
+mips-add-custom-serial.h-with-base_baud-override-for-generic-kernel.patch
diff --git a/queue-4.14/usb-serial-option-add-quectel-bg96-id.patch b/queue-4.14/usb-serial-option-add-quectel-bg96-id.patch
new file mode 100644 (file)
index 0000000..92aadf4
--- /dev/null
@@ -0,0 +1,41 @@
+From c654b21ede93845863597de9ad774fd30db5f2ab Mon Sep 17 00:00:00 2001
+From: Sebastian Sjoholm <ssjoholm@mac.com>
+Date: Mon, 20 Nov 2017 19:29:32 +0100
+Subject: USB: serial: option: add Quectel BG96 id
+
+From: Sebastian Sjoholm <ssjoholm@mac.com>
+
+commit c654b21ede93845863597de9ad774fd30db5f2ab upstream.
+
+Quectel BG96 is an Qualcomm MDM9206 based IoT modem, supporting both
+CAT-M and NB-IoT. Tested hardware is BG96 mounted on Quectel
+development board (EVB). The USB id is added to option.c to allow
+DIAG,GPS,AT and modem communication with the BG96.
+
+Signed-off-by: Sebastian Sjoholm <ssjoholm@mac.com>
+Signed-off-by: Johan Hovold <johan@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/serial/option.c |    3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/drivers/usb/serial/option.c
++++ b/drivers/usb/serial/option.c
+@@ -241,6 +241,7 @@ static void option_instat_callback(struc
+ /* These Quectel products use Quectel's vendor ID */
+ #define QUECTEL_PRODUCT_EC21                  0x0121
+ #define QUECTEL_PRODUCT_EC25                  0x0125
++#define QUECTEL_PRODUCT_BG96                  0x0296
+ #define CMOTECH_VENDOR_ID                     0x16d8
+ #define CMOTECH_PRODUCT_6001                  0x6001
+@@ -1185,6 +1186,8 @@ static const struct usb_device_id option
+         .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
+       { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC25),
+         .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
++      { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96),
++        .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
+       { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) },
+       { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_300) },
+       { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6003),
diff --git a/queue-4.14/usb-serial-usb_debug-add-new-usb-device-id.patch b/queue-4.14/usb-serial-usb_debug-add-new-usb-device-id.patch
new file mode 100644 (file)
index 0000000..ca3d322
--- /dev/null
@@ -0,0 +1,36 @@
+From 762ff4678e89a5e3f8b2237533e04d3ef2737e78 Mon Sep 17 00:00:00 2001
+From: Lu Baolu <baolu.lu@linux.intel.com>
+Date: Tue, 28 Nov 2017 12:40:59 +0800
+Subject: USB: serial: usb_debug: add new USB device id
+
+From: Lu Baolu <baolu.lu@linux.intel.com>
+
+commit 762ff4678e89a5e3f8b2237533e04d3ef2737e78 upstream.
+
+USB vendor id and product id for Linux USB Debug Target is added.
+
+Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
+Signed-off-by: Johan Hovold <johan@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/serial/usb_debug.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/drivers/usb/serial/usb_debug.c
++++ b/drivers/usb/serial/usb_debug.c
+@@ -34,12 +34,14 @@ static const struct usb_device_id id_tab
+ };
+ static const struct usb_device_id dbc_id_table[] = {
++      { USB_DEVICE(0x1d6b, 0x0010) },
+       { USB_DEVICE(0x1d6b, 0x0011) },
+       { },
+ };
+ static const struct usb_device_id id_table_combined[] = {
+       { USB_DEVICE(0x0525, 0x127a) },
++      { USB_DEVICE(0x1d6b, 0x0010) },
+       { USB_DEVICE(0x1d6b, 0x0011) },
+       { },
+ };