]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.9-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 29 Apr 2018 11:06:12 +0000 (13:06 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 29 Apr 2018 11:06:12 +0000 (13:06 +0200)
added patches:
alsa-dice-fix-error-path-to-destroy-initialized-stream-data.patch
alsa-dice-fix-oui-for-tc-group.patch
alsa-usb-audio-skip-broken-eu-on-dell-dock-usb-audio.patch
drm-virtio-fix-vq-wait_event-condition.patch
random-fix-possible-sleeping-allocation-from-irq-context.patch
random-rate-limit-unseeded-randomness-warnings.patch
tty-don-t-call-panic-at-tty_ldisc_init.patch
tty-n_gsm-fix-dlci-handling-for-adm-mode-if-debug-2-is-not-set.patch
tty-n_gsm-fix-long-delays-with-control-frame-timeouts-in-adm-mode.patch
tty-use-__gfp_nofail-for-tty_ldisc_get.patch
usb-core-add-quirk-for-hp-v222w-16gb-mini.patch
usb-increment-wakeup-count-on-remote-wakeup.patch
usb-serial-cp210x-add-id-for-ni-usb-serial-console.patch
usb-serial-ftdi_sio-use-jtag-quirk-for-arrow-usb-blaster.patch
usb-serial-simple-add-libtransistor-console.patch
usbip-usbip_event-fix-to-not-print-kernel-pointer-address.patch
usbip-usbip_host-fix-to-hold-parent-lock-for-device_attach-calls.patch
usbip-vhci_hcd-fix-usb-device-and-sockfd-leaks.patch
virtio-add-ability-to-iterate-over-vqs.patch
virtio_console-free-buffers-after-reset.patch

21 files changed:
queue-4.9/alsa-dice-fix-error-path-to-destroy-initialized-stream-data.patch [new file with mode: 0644]
queue-4.9/alsa-dice-fix-oui-for-tc-group.patch [new file with mode: 0644]
queue-4.9/alsa-usb-audio-skip-broken-eu-on-dell-dock-usb-audio.patch [new file with mode: 0644]
queue-4.9/drm-virtio-fix-vq-wait_event-condition.patch [new file with mode: 0644]
queue-4.9/random-fix-possible-sleeping-allocation-from-irq-context.patch [new file with mode: 0644]
queue-4.9/random-rate-limit-unseeded-randomness-warnings.patch [new file with mode: 0644]
queue-4.9/series
queue-4.9/tty-don-t-call-panic-at-tty_ldisc_init.patch [new file with mode: 0644]
queue-4.9/tty-n_gsm-fix-dlci-handling-for-adm-mode-if-debug-2-is-not-set.patch [new file with mode: 0644]
queue-4.9/tty-n_gsm-fix-long-delays-with-control-frame-timeouts-in-adm-mode.patch [new file with mode: 0644]
queue-4.9/tty-use-__gfp_nofail-for-tty_ldisc_get.patch [new file with mode: 0644]
queue-4.9/usb-core-add-quirk-for-hp-v222w-16gb-mini.patch [new file with mode: 0644]
queue-4.9/usb-increment-wakeup-count-on-remote-wakeup.patch [new file with mode: 0644]
queue-4.9/usb-serial-cp210x-add-id-for-ni-usb-serial-console.patch [new file with mode: 0644]
queue-4.9/usb-serial-ftdi_sio-use-jtag-quirk-for-arrow-usb-blaster.patch [new file with mode: 0644]
queue-4.9/usb-serial-simple-add-libtransistor-console.patch [new file with mode: 0644]
queue-4.9/usbip-usbip_event-fix-to-not-print-kernel-pointer-address.patch [new file with mode: 0644]
queue-4.9/usbip-usbip_host-fix-to-hold-parent-lock-for-device_attach-calls.patch [new file with mode: 0644]
queue-4.9/usbip-vhci_hcd-fix-usb-device-and-sockfd-leaks.patch [new file with mode: 0644]
queue-4.9/virtio-add-ability-to-iterate-over-vqs.patch [new file with mode: 0644]
queue-4.9/virtio_console-free-buffers-after-reset.patch [new file with mode: 0644]

diff --git a/queue-4.9/alsa-dice-fix-error-path-to-destroy-initialized-stream-data.patch b/queue-4.9/alsa-dice-fix-error-path-to-destroy-initialized-stream-data.patch
new file mode 100644 (file)
index 0000000..7e5f61f
--- /dev/null
@@ -0,0 +1,35 @@
+From 0f925660a7bc49b269c163249a5d06da3a0c7b0a Mon Sep 17 00:00:00 2001
+From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
+Date: Thu, 26 Apr 2018 22:00:29 +0900
+Subject: ALSA: dice: fix error path to destroy initialized stream data
+
+From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
+
+commit 0f925660a7bc49b269c163249a5d06da3a0c7b0a upstream.
+
+In error path of snd_dice_stream_init_duplex(), stream data for incoming
+packet can be left to be initialized.
+
+This commit fixes it.
+
+Fixes: 436b5abe2224 ('ALSA: dice: handle whole available isochronous streams')
+Cc: <stable@vger.kernel.org> # v4.6+
+Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/firewire/dice/dice-stream.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/sound/firewire/dice/dice-stream.c
++++ b/sound/firewire/dice/dice-stream.c
+@@ -425,7 +425,7 @@ int snd_dice_stream_init_duplex(struct s
+               err = init_stream(dice, AMDTP_IN_STREAM, i);
+               if (err < 0) {
+                       for (; i >= 0; i--)
+-                              destroy_stream(dice, AMDTP_OUT_STREAM, i);
++                              destroy_stream(dice, AMDTP_IN_STREAM, i);
+                       goto end;
+               }
+       }
diff --git a/queue-4.9/alsa-dice-fix-oui-for-tc-group.patch b/queue-4.9/alsa-dice-fix-oui-for-tc-group.patch
new file mode 100644 (file)
index 0000000..f9ecf80
--- /dev/null
@@ -0,0 +1,34 @@
+From 10412c420af9ba1f3de8483a95d360e5eb5bfc84 Mon Sep 17 00:00:00 2001
+From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
+Date: Sun, 22 Apr 2018 21:19:24 +0900
+Subject: ALSA: dice: fix OUI for TC group
+
+From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
+
+commit 10412c420af9ba1f3de8483a95d360e5eb5bfc84 upstream.
+
+OUI for TC Electronic is 0x000166, for TC GROUP A/S. 0x001486 is for Echo
+Digital Audio Corporation.
+
+Fixes: 7cafc65b3aa1 ('ALSA: dice: force to add two pcm devices for listed models')
+Cc: <stable@vger.kernel.org> # v4.6+
+Reference: http://standards-oui.ieee.org/oui/oui.txt
+Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/firewire/dice/dice.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/sound/firewire/dice/dice.c
++++ b/sound/firewire/dice/dice.c
+@@ -14,7 +14,7 @@ MODULE_LICENSE("GPL v2");
+ #define OUI_WEISS             0x001c6a
+ #define OUI_LOUD              0x000ff2
+ #define OUI_FOCUSRITE         0x00130e
+-#define OUI_TCELECTRONIC      0x001486
++#define OUI_TCELECTRONIC      0x000166
+ #define DICE_CATEGORY_ID      0x04
+ #define WEISS_CATEGORY_ID     0x00
diff --git a/queue-4.9/alsa-usb-audio-skip-broken-eu-on-dell-dock-usb-audio.patch b/queue-4.9/alsa-usb-audio-skip-broken-eu-on-dell-dock-usb-audio.patch
new file mode 100644 (file)
index 0000000..f99a4ef
--- /dev/null
@@ -0,0 +1,37 @@
+From 1d8d6428d1da642ddd75b0be2d1bb1123ff8e017 Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Tue, 24 Apr 2018 11:11:48 +0200
+Subject: ALSA: usb-audio: Skip broken EU on Dell dock USB-audio
+
+From: Takashi Iwai <tiwai@suse.de>
+
+commit 1d8d6428d1da642ddd75b0be2d1bb1123ff8e017 upstream.
+
+The Dell Dock USB-audio device with 0bda:4014 is behaving notoriously
+bad, and we have already applied some workaround to avoid the firmware
+hiccup.  Yet we still need to skip one thing, the Extension Unit at ID
+4, which doesn't react correctly to the mixer ctl access.
+
+Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=1090658
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/usb/mixer_maps.c |    3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/sound/usb/mixer_maps.c
++++ b/sound/usb/mixer_maps.c
+@@ -353,8 +353,11 @@ static struct usbmix_name_map bose_compa
+ /*
+  * Dell usb dock with ALC4020 codec had a firmware problem where it got
+  * screwed up when zero volume is passed; just skip it as a workaround
++ *
++ * Also the extension unit gives an access error, so skip it as well.
+  */
+ static const struct usbmix_name_map dell_alc4020_map[] = {
++      { 4, NULL },    /* extension unit */
+       { 16, NULL },
+       { 19, NULL },
+       { 0 }
diff --git a/queue-4.9/drm-virtio-fix-vq-wait_event-condition.patch b/queue-4.9/drm-virtio-fix-vq-wait_event-condition.patch
new file mode 100644 (file)
index 0000000..a271618
--- /dev/null
@@ -0,0 +1,45 @@
+From d02d270014f70dcab0117776b81a37b6fca745ae Mon Sep 17 00:00:00 2001
+From: Gerd Hoffmann <kraxel@redhat.com>
+Date: Tue, 3 Apr 2018 11:59:04 +0200
+Subject: drm/virtio: fix vq wait_event condition
+
+From: Gerd Hoffmann <kraxel@redhat.com>
+
+commit d02d270014f70dcab0117776b81a37b6fca745ae upstream.
+
+Wait until we have enough space in the virt queue to actually queue up
+our request.  Avoids the guest spinning in case we have a non-zero
+amount of free entries but not enough for the request.
+
+Cc: stable@vger.kernel.org
+Reported-by: Alain Magloire <amagloire@blackberry.com>
+Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
+Reviewed-by: Dave Airlie <airlied@redhat.com>
+Link: http://patchwork.freedesktop.org/patch/msgid/20180403095904.11152-1-kraxel@redhat.com
+Signed-off-by: Sean Paul <seanpaul@chromium.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpu/drm/virtio/virtgpu_vq.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/gpu/drm/virtio/virtgpu_vq.c
++++ b/drivers/gpu/drm/virtio/virtgpu_vq.c
+@@ -324,7 +324,7 @@ retry:
+       ret = virtqueue_add_sgs(vq, sgs, outcnt, incnt, vbuf, GFP_ATOMIC);
+       if (ret == -ENOSPC) {
+               spin_unlock(&vgdev->ctrlq.qlock);
+-              wait_event(vgdev->ctrlq.ack_queue, vq->num_free);
++              wait_event(vgdev->ctrlq.ack_queue, vq->num_free >= outcnt + incnt);
+               spin_lock(&vgdev->ctrlq.qlock);
+               goto retry;
+       } else {
+@@ -399,7 +399,7 @@ retry:
+       ret = virtqueue_add_sgs(vq, sgs, outcnt, 0, vbuf, GFP_ATOMIC);
+       if (ret == -ENOSPC) {
+               spin_unlock(&vgdev->cursorq.qlock);
+-              wait_event(vgdev->cursorq.ack_queue, vq->num_free);
++              wait_event(vgdev->cursorq.ack_queue, vq->num_free >= outcnt);
+               spin_lock(&vgdev->cursorq.qlock);
+               goto retry;
+       } else {
diff --git a/queue-4.9/random-fix-possible-sleeping-allocation-from-irq-context.patch b/queue-4.9/random-fix-possible-sleeping-allocation-from-irq-context.patch
new file mode 100644 (file)
index 0000000..d7afef6
--- /dev/null
@@ -0,0 +1,49 @@
+From 6c1e851c4edc13a43adb3ea4044e3fc8f43ccf7d Mon Sep 17 00:00:00 2001
+From: Theodore Ts'o <tytso@mit.edu>
+Date: Mon, 23 Apr 2018 18:51:28 -0400
+Subject: random: fix possible sleeping allocation from irq context
+
+From: Theodore Ts'o <tytso@mit.edu>
+
+commit 6c1e851c4edc13a43adb3ea4044e3fc8f43ccf7d upstream.
+
+We can do a sleeping allocation from an irq context when CONFIG_NUMA
+is enabled.  Fix this by initializing the NUMA crng instances in a
+workqueue.
+
+Reported-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
+Reported-by: syzbot+9de458f6a5e713ee8c1a@syzkaller.appspotmail.com
+Fixes: 8ef35c866f8862df ("random: set up the NUMA crng instances...")
+Cc: stable@vger.kernel.org
+Signed-off-by: Theodore Ts'o <tytso@mit.edu>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/char/random.c |    9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+--- a/drivers/char/random.c
++++ b/drivers/char/random.c
+@@ -820,7 +820,7 @@ static int crng_fast_load(const char *cp
+ }
+ #ifdef CONFIG_NUMA
+-static void numa_crng_init(void)
++static void do_numa_crng_init(struct work_struct *work)
+ {
+       int i;
+       struct crng_state *crng;
+@@ -841,6 +841,13 @@ static void numa_crng_init(void)
+               kfree(pool);
+       }
+ }
++
++static DECLARE_WORK(numa_crng_init_work, do_numa_crng_init);
++
++static void numa_crng_init(void)
++{
++      schedule_work(&numa_crng_init_work);
++}
+ #else
+ static void numa_crng_init(void) {}
+ #endif
diff --git a/queue-4.9/random-rate-limit-unseeded-randomness-warnings.patch b/queue-4.9/random-rate-limit-unseeded-randomness-warnings.patch
new file mode 100644 (file)
index 0000000..2d449d0
--- /dev/null
@@ -0,0 +1,90 @@
+From 4e00b339e264802851aff8e73cde7d24b57b18ce Mon Sep 17 00:00:00 2001
+From: Theodore Ts'o <tytso@mit.edu>
+Date: Wed, 25 Apr 2018 01:12:32 -0400
+Subject: random: rate limit unseeded randomness warnings
+
+From: Theodore Ts'o <tytso@mit.edu>
+
+commit 4e00b339e264802851aff8e73cde7d24b57b18ce upstream.
+
+On systems without sufficient boot randomness, no point spamming dmesg.
+
+Signed-off-by: Theodore Ts'o <tytso@mit.edu>
+Cc: stable@vger.kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/char/random.c |   34 +++++++++++++++++++++++++++++++---
+ 1 file changed, 31 insertions(+), 3 deletions(-)
+
+--- a/drivers/char/random.c
++++ b/drivers/char/random.c
+@@ -259,6 +259,7 @@
+ #include <linux/kmemcheck.h>
+ #include <linux/workqueue.h>
+ #include <linux/irq.h>
++#include <linux/ratelimit.h>
+ #include <linux/syscalls.h>
+ #include <linux/completion.h>
+ #include <linux/uuid.h>
+@@ -444,6 +445,16 @@ static void _crng_backtrack_protect(stru
+                                   __u8 tmp[CHACHA20_BLOCK_SIZE], int used);
+ static void process_random_ready_list(void);
++static struct ratelimit_state unseeded_warning =
++      RATELIMIT_STATE_INIT("warn_unseeded_randomness", HZ, 3);
++static struct ratelimit_state urandom_warning =
++      RATELIMIT_STATE_INIT("warn_urandom_randomness", HZ, 3);
++
++static int ratelimit_disable __read_mostly;
++
++module_param_named(ratelimit_disable, ratelimit_disable, int, 0644);
++MODULE_PARM_DESC(ratelimit_disable, "Disable random ratelimit suppression");
++
+ /**********************************************************************
+  *
+  * OS independent entropy store.   Here are the functions which handle
+@@ -886,6 +897,18 @@ static void crng_reseed(struct crng_stat
+               process_random_ready_list();
+               wake_up_interruptible(&crng_init_wait);
+               pr_notice("random: crng init done\n");
++              if (unseeded_warning.missed) {
++                      pr_notice("random: %d get_random_xx warning(s) missed "
++                                "due to ratelimiting\n",
++                                unseeded_warning.missed);
++                      unseeded_warning.missed = 0;
++              }
++              if (urandom_warning.missed) {
++                      pr_notice("random: %d urandom warning(s) missed "
++                                "due to ratelimiting\n",
++                                urandom_warning.missed);
++                      urandom_warning.missed = 0;
++              }
+       }
+       spin_unlock_irqrestore(&crng->lock, flags);
+ }
+@@ -1699,6 +1722,10 @@ static int rand_initialize(void)
+       init_std_data(&blocking_pool);
+       crng_initialize(&primary_crng);
+       crng_global_init_time = jiffies;
++      if (ratelimit_disable) {
++              urandom_warning.interval = 0;
++              unseeded_warning.interval = 0;
++      }
+       return 0;
+ }
+ early_initcall(rand_initialize);
+@@ -1766,9 +1793,10 @@ urandom_read(struct file *file, char __u
+       if (!crng_ready() && maxwarn > 0) {
+               maxwarn--;
+-              printk(KERN_NOTICE "random: %s: uninitialized urandom read "
+-                     "(%zd bytes read)\n",
+-                     current->comm, nbytes);
++              if (__ratelimit(&urandom_warning))
++                      printk(KERN_NOTICE "random: %s: uninitialized "
++                             "urandom read (%zd bytes read)\n",
++                             current->comm, nbytes);
+               spin_lock_irqsave(&primary_crng.lock, flags);
+               crng_init_cnt = 0;
+               spin_unlock_irqrestore(&primary_crng.lock, flags);
index e220dacddc56fddab5988b6d0b8413bb845110db..e96e847de857a245bab579573605610a52256227 100644 (file)
@@ -3,3 +3,23 @@ ext4-set-h_journal-if-there-is-a-failure-starting-a-reserved-handle.patch
 ext4-add-validity-checks-for-bitmap-block-numbers.patch
 ext4-fix-bitmap-position-validation.patch
 random-set-up-the-numa-crng-instances-after-the-crng-is-fully-initialized.patch
+random-fix-possible-sleeping-allocation-from-irq-context.patch
+random-rate-limit-unseeded-randomness-warnings.patch
+usbip-usbip_event-fix-to-not-print-kernel-pointer-address.patch
+usbip-usbip_host-fix-to-hold-parent-lock-for-device_attach-calls.patch
+usbip-vhci_hcd-fix-usb-device-and-sockfd-leaks.patch
+usb-serial-simple-add-libtransistor-console.patch
+usb-serial-ftdi_sio-use-jtag-quirk-for-arrow-usb-blaster.patch
+usb-serial-cp210x-add-id-for-ni-usb-serial-console.patch
+usb-core-add-quirk-for-hp-v222w-16gb-mini.patch
+usb-increment-wakeup-count-on-remote-wakeup.patch
+alsa-usb-audio-skip-broken-eu-on-dell-dock-usb-audio.patch
+virtio-add-ability-to-iterate-over-vqs.patch
+virtio_console-free-buffers-after-reset.patch
+drm-virtio-fix-vq-wait_event-condition.patch
+tty-don-t-call-panic-at-tty_ldisc_init.patch
+tty-n_gsm-fix-long-delays-with-control-frame-timeouts-in-adm-mode.patch
+tty-n_gsm-fix-dlci-handling-for-adm-mode-if-debug-2-is-not-set.patch
+tty-use-__gfp_nofail-for-tty_ldisc_get.patch
+alsa-dice-fix-oui-for-tc-group.patch
+alsa-dice-fix-error-path-to-destroy-initialized-stream-data.patch
diff --git a/queue-4.9/tty-don-t-call-panic-at-tty_ldisc_init.patch b/queue-4.9/tty-don-t-call-panic-at-tty_ldisc_init.patch
new file mode 100644 (file)
index 0000000..14011a4
--- /dev/null
@@ -0,0 +1,72 @@
+From 903f9db10f18f735e62ba447147b6c434b6af003 Mon Sep 17 00:00:00 2001
+From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
+Date: Thu, 5 Apr 2018 19:40:16 +0900
+Subject: tty: Don't call panic() at tty_ldisc_init()
+
+From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
+
+commit 903f9db10f18f735e62ba447147b6c434b6af003 upstream.
+
+syzbot is reporting kernel panic [1] triggered by memory allocation failure
+at tty_ldisc_get() from tty_ldisc_init(). But since both tty_ldisc_get()
+and caller of tty_ldisc_init() can cleanly handle errors, tty_ldisc_init()
+does not need to call panic() when tty_ldisc_get() failed.
+
+[1] https://syzkaller.appspot.com/bug?id=883431818e036ae6a9981156a64b821110f39187
+
+Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
+Reported-by: syzbot <syzkaller@googlegroups.com>
+Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Cc: Jiri Slaby <jslaby@suse.com>
+Cc: stable <stable@vger.kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/tty/tty_io.c    |    5 ++++-
+ drivers/tty/tty_ldisc.c |    5 +++--
+ include/linux/tty.h     |    2 +-
+ 3 files changed, 8 insertions(+), 4 deletions(-)
+
+--- a/drivers/tty/tty_io.c
++++ b/drivers/tty/tty_io.c
+@@ -3170,7 +3170,10 @@ struct tty_struct *alloc_tty_struct(stru
+       kref_init(&tty->kref);
+       tty->magic = TTY_MAGIC;
+-      tty_ldisc_init(tty);
++      if (tty_ldisc_init(tty)) {
++              kfree(tty);
++              return NULL;
++      }
+       tty->session = NULL;
+       tty->pgrp = NULL;
+       mutex_init(&tty->legacy_mutex);
+--- a/drivers/tty/tty_ldisc.c
++++ b/drivers/tty/tty_ldisc.c
+@@ -753,12 +753,13 @@ void tty_ldisc_release(struct tty_struct
+  *    the tty structure is not completely set up when this call is made.
+  */
+-void tty_ldisc_init(struct tty_struct *tty)
++int tty_ldisc_init(struct tty_struct *tty)
+ {
+       struct tty_ldisc *ld = tty_ldisc_get(tty, N_TTY);
+       if (IS_ERR(ld))
+-              panic("n_tty: init_tty");
++              return PTR_ERR(ld);
+       tty->ldisc = ld;
++      return 0;
+ }
+ /**
+--- a/include/linux/tty.h
++++ b/include/linux/tty.h
+@@ -657,7 +657,7 @@ extern int tty_unregister_ldisc(int disc
+ extern int tty_set_ldisc(struct tty_struct *tty, int disc);
+ extern int tty_ldisc_setup(struct tty_struct *tty, struct tty_struct *o_tty);
+ extern void tty_ldisc_release(struct tty_struct *tty);
+-extern void tty_ldisc_init(struct tty_struct *tty);
++extern int __must_check tty_ldisc_init(struct tty_struct *tty);
+ extern void tty_ldisc_deinit(struct tty_struct *tty);
+ extern int tty_ldisc_receive_buf(struct tty_ldisc *ld, unsigned char *p,
+                                char *f, int count);
diff --git a/queue-4.9/tty-n_gsm-fix-dlci-handling-for-adm-mode-if-debug-2-is-not-set.patch b/queue-4.9/tty-n_gsm-fix-dlci-handling-for-adm-mode-if-debug-2-is-not-set.patch
new file mode 100644 (file)
index 0000000..9d0a404
--- /dev/null
@@ -0,0 +1,69 @@
+From b2d89ad9c9682e795ed6eeb9ed455789ad6cedf1 Mon Sep 17 00:00:00 2001
+From: Tony Lindgren <tony@atomide.com>
+Date: Sat, 7 Apr 2018 10:19:51 -0700
+Subject: tty: n_gsm: Fix DLCI handling for ADM mode if debug & 2 is not set
+
+From: Tony Lindgren <tony@atomide.com>
+
+commit b2d89ad9c9682e795ed6eeb9ed455789ad6cedf1 upstream.
+
+At least on droid 4 with control channel in ADM mode, there is no response
+to Modem Status Command (MSC). Currently gsmtty_modem_update() expects to
+have data in dlci->modem_rx unless debug & 2 is set. This means that on
+droid 4, things only work if debug & 2 is set.
+
+Let's fix the issue by ignoring empty dlci->modem_rx for ADM mode. In
+the AMD mode, CMD_MSC will never respond and gsm_process_modem() won't
+get called to set dlci->modem_rx.
+
+And according to ts_127010v140000p.pdf, MSC is only relevant if basic
+option is chosen, so let's test for that too.
+
+Fixes: ea3d8465ab9b ("tty: n_gsm: Allow ADM response in addition to UA for control dlci")
+Cc: linux-serial@vger.kernel.org
+Cc: Alan Cox <alan@llwyncelyn.cymru>
+Cc: Dan Williams <dcbw@redhat.com>
+Cc: Jiri Prchal <jiri.prchal@aksignal.cz>
+Cc: Jiri Slaby <jslaby@suse.cz>
+Cc: Marcel Partap <mpartap@gmx.net>
+Cc: Merlijn Wajer <merlijn@wizzup.org>
+Cc: Michael Nazzareno Trimarchi <michael@amarulasolutions.com>
+Cc: Michael Scott <michael.scott@linaro.org>
+Cc: Pavel Machek <pavel@ucw.cz>
+Cc: Peter Hurley <peter@hurleysoftware.com>
+Cc: Russ Gorby <russ.gorby@intel.com>
+Cc: Sascha Hauer <s.hauer@pengutronix.de>
+Cc: Sebastian Reichel <sre@kernel.org>
+Signed-off-by: Tony Lindgren <tony@atomide.com>
+Cc: stable <stable@vger.kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/tty/n_gsm.c |   11 +++++++++++
+ 1 file changed, 11 insertions(+)
+
+--- a/drivers/tty/n_gsm.c
++++ b/drivers/tty/n_gsm.c
+@@ -2875,11 +2875,22 @@ static int gsmtty_modem_update(struct gs
+ static int gsm_carrier_raised(struct tty_port *port)
+ {
+       struct gsm_dlci *dlci = container_of(port, struct gsm_dlci, port);
++      struct gsm_mux *gsm = dlci->gsm;
++
+       /* Not yet open so no carrier info */
+       if (dlci->state != DLCI_OPEN)
+               return 0;
+       if (debug & 2)
+               return 1;
++
++      /*
++       * Basic mode with control channel in ADM mode may not respond
++       * to CMD_MSC at all and modem_rx is empty.
++       */
++      if (gsm->encoding == 0 && gsm->dlci[0]->mode == DLCI_MODE_ADM &&
++          !dlci->modem_rx)
++              return 1;
++
+       return dlci->modem_rx & TIOCM_CD;
+ }
diff --git a/queue-4.9/tty-n_gsm-fix-long-delays-with-control-frame-timeouts-in-adm-mode.patch b/queue-4.9/tty-n_gsm-fix-long-delays-with-control-frame-timeouts-in-adm-mode.patch
new file mode 100644 (file)
index 0000000..2232746
--- /dev/null
@@ -0,0 +1,91 @@
+From e9ec22547986dd32c5c70da78107ce35dbff1344 Mon Sep 17 00:00:00 2001
+From: Tony Lindgren <tony@atomide.com>
+Date: Sat, 7 Apr 2018 10:19:50 -0700
+Subject: tty: n_gsm: Fix long delays with control frame timeouts in ADM mode
+
+From: Tony Lindgren <tony@atomide.com>
+
+commit e9ec22547986dd32c5c70da78107ce35dbff1344 upstream.
+
+Commit ea3d8465ab9b ("tty: n_gsm: Allow ADM response in addition to UA for
+control dlci") added support for DLCI to stay in Asynchronous Disconnected
+Mode (ADM). But we still get long delays waiting for commands to other
+DLCI to complete:
+
+--> 5) C: SABM(P)
+Q>  0) C: UIH(F)
+Q>  0) C: UIH(F)
+Q>  0) C: UIH(F)
+...
+
+This happens because gsm_control_send() sets cretries timer to T2 that is
+by default set to 34. This will cause resend for T2 times for the control
+frame. In ADM mode, we will never get a response so the control frame, so
+retries are just delaying all the commands.
+
+Let's fix the issue by setting DLCI_MODE_ADM flag after detecting the ADM
+mode for the control DLCI. Then we can use that in gsm_control_send() to
+set retries to 1. This means the control frame will be sent once allowing
+the other end at an opportunity to switch from ADM to ABM mode.
+
+Note that retries will be decremented in gsm_control_retransmit() so
+we don't want to set it to 0 here.
+
+Fixes: ea3d8465ab9b ("tty: n_gsm: Allow ADM response in addition to UA for control dlci")
+Cc: linux-serial@vger.kernel.org
+Cc: Alan Cox <alan@llwyncelyn.cymru>
+Cc: Dan Williams <dcbw@redhat.com>
+Cc: Jiri Prchal <jiri.prchal@aksignal.cz>
+Cc: Jiri Slaby <jslaby@suse.cz>
+Cc: Marcel Partap <mpartap@gmx.net>
+Cc: Merlijn Wajer <merlijn@wizzup.org>
+Cc: Michael Nazzareno Trimarchi <michael@amarulasolutions.com>
+Cc: Michael Scott <michael.scott@linaro.org>
+Cc: Pavel Machek <pavel@ucw.cz>
+Cc: Peter Hurley <peter@hurleysoftware.com>
+Cc: Russ Gorby <russ.gorby@intel.com>
+Cc: Sascha Hauer <s.hauer@pengutronix.de>
+Cc: Sebastian Reichel <sre@kernel.org>
+Signed-off-by: Tony Lindgren <tony@atomide.com>
+Cc: stable <stable@vger.kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/tty/n_gsm.c |   12 +++++++++++-
+ 1 file changed, 11 insertions(+), 1 deletion(-)
+
+--- a/drivers/tty/n_gsm.c
++++ b/drivers/tty/n_gsm.c
+@@ -137,6 +137,9 @@ struct gsm_dlci {
+       struct mutex mutex;
+       /* Link layer */
++      int mode;
++#define DLCI_MODE_ABM         0       /* Normal Asynchronous Balanced Mode */
++#define DLCI_MODE_ADM         1       /* Asynchronous Disconnected Mode */
+       spinlock_t lock;        /* Protects the internal state */
+       struct timer_list t1;   /* Retransmit timer for SABM and UA */
+       int retries;
+@@ -1380,7 +1383,13 @@ retry:
+       ctrl->data = data;
+       ctrl->len = clen;
+       gsm->pending_cmd = ctrl;
+-      gsm->cretries = gsm->n2;
++
++      /* If DLCI0 is in ADM mode skip retries, it won't respond */
++      if (gsm->dlci[0]->mode == DLCI_MODE_ADM)
++              gsm->cretries = 1;
++      else
++              gsm->cretries = gsm->n2;
++
+       mod_timer(&gsm->t2_timer, jiffies + gsm->t2 * HZ / 100);
+       gsm_control_transmit(gsm, ctrl);
+       spin_unlock_irqrestore(&gsm->control_lock, flags);
+@@ -1488,6 +1497,7 @@ static void gsm_dlci_t1(unsigned long da
+                       if (debug & 8)
+                               pr_info("DLCI %d opening in ADM mode.\n",
+                                       dlci->addr);
++                      dlci->mode = DLCI_MODE_ADM;
+                       gsm_dlci_open(dlci);
+               } else {
+                       gsm_dlci_close(dlci);
diff --git a/queue-4.9/tty-use-__gfp_nofail-for-tty_ldisc_get.patch b/queue-4.9/tty-use-__gfp_nofail-for-tty_ldisc_get.patch
new file mode 100644 (file)
index 0000000..4444887
--- /dev/null
@@ -0,0 +1,57 @@
+From bcdd0ca8cb8730573afebcaae4138f8f4c8eaa20 Mon Sep 17 00:00:00 2001
+From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
+Date: Wed, 25 Apr 2018 20:12:31 +0900
+Subject: tty: Use __GFP_NOFAIL for tty_ldisc_get()
+
+From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
+
+commit bcdd0ca8cb8730573afebcaae4138f8f4c8eaa20 upstream.
+
+syzbot is reporting crashes triggered by memory allocation fault injection
+at tty_ldisc_get() [1]. As an attempt to handle OOM in a graceful way, we
+have tried commit 5362544bebe85071 ("tty: don't panic on OOM in
+tty_set_ldisc()"). But we reverted that attempt by commit a8983d01f9b7d600
+("Revert "tty: don't panic on OOM in tty_set_ldisc()"") due to reproducible
+crash. We should spend resource for finding and fixing race condition bugs
+rather than complicate error paths for 2 * sizeof(void *) bytes allocation
+failure.
+
+[1] https://syzkaller.appspot.com/bug?id=489d33fa386453859ead58ff5171d43772b13aa3
+
+Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
+Reported-by: syzbot <syzbot+40b7287c2dc987c48c81@syzkaller.appspotmail.com>
+Cc: Michal Hocko <mhocko@suse.com>
+Cc: Vegard Nossum <vegard.nossum@gmail.com>
+Cc: Dmitry Vyukov <dvyukov@google.com>
+Cc: Jiri Slaby <jslaby@suse.com>
+Cc: Peter Hurley <peter@hurleysoftware.com>
+Cc: One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: stable <stable@vger.kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/tty/tty_ldisc.c |   11 +++++------
+ 1 file changed, 5 insertions(+), 6 deletions(-)
+
+--- a/drivers/tty/tty_ldisc.c
++++ b/drivers/tty/tty_ldisc.c
+@@ -175,12 +175,11 @@ static struct tty_ldisc *tty_ldisc_get(s
+                       return ERR_CAST(ldops);
+       }
+-      ld = kmalloc(sizeof(struct tty_ldisc), GFP_KERNEL);
+-      if (ld == NULL) {
+-              put_ldops(ldops);
+-              return ERR_PTR(-ENOMEM);
+-      }
+-
++      /*
++       * There is no way to handle allocation failure of only 16 bytes.
++       * Let's simplify error handling and save more memory.
++       */
++      ld = kmalloc(sizeof(struct tty_ldisc), GFP_KERNEL | __GFP_NOFAIL);
+       ld->ops = ldops;
+       ld->tty = tty;
diff --git a/queue-4.9/usb-core-add-quirk-for-hp-v222w-16gb-mini.patch b/queue-4.9/usb-core-add-quirk-for-hp-v222w-16gb-mini.patch
new file mode 100644 (file)
index 0000000..2f93976
--- /dev/null
@@ -0,0 +1,37 @@
+From 3180dabe08e3653bf0a838553905d88f3773f29c Mon Sep 17 00:00:00 2001
+From: Kamil Lulko <kamilx.lulko@intel.com>
+Date: Thu, 19 Apr 2018 16:54:02 -0700
+Subject: usb: core: Add quirk for HP v222w 16GB Mini
+
+From: Kamil Lulko <kamilx.lulko@intel.com>
+
+commit 3180dabe08e3653bf0a838553905d88f3773f29c upstream.
+
+Add DELAY_INIT quirk to fix the following problem with HP
+v222w 16GB Mini:
+
+usb 1-3: unable to read config index 0 descriptor/start: -110
+usb 1-3: can't read configurations, error -110
+usb 1-3: can't set config #1, error -110
+
+Signed-off-by: Kamil Lulko <kamilx.lulko@intel.com>
+Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
+Cc: stable <stable@vger.kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/core/quirks.c |    3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/drivers/usb/core/quirks.c
++++ b/drivers/usb/core/quirks.c
+@@ -45,6 +45,9 @@ static const struct usb_device_id usb_qu
+       { USB_DEVICE(0x03f0, 0x0701), .driver_info =
+                       USB_QUIRK_STRING_FETCH_255 },
++      /* HP v222w 16GB Mini USB Drive */
++      { USB_DEVICE(0x03f0, 0x3f40), .driver_info = USB_QUIRK_DELAY_INIT },
++
+       /* Creative SB Audigy 2 NX */
+       { USB_DEVICE(0x041e, 0x3020), .driver_info = USB_QUIRK_RESET_RESUME },
diff --git a/queue-4.9/usb-increment-wakeup-count-on-remote-wakeup.patch b/queue-4.9/usb-increment-wakeup-count-on-remote-wakeup.patch
new file mode 100644 (file)
index 0000000..97ffe56
--- /dev/null
@@ -0,0 +1,82 @@
+From 83a62c51ba7b3c0bf45150c4eac7aefc6c785e94 Mon Sep 17 00:00:00 2001
+From: Ravi Chandra Sadineni <ravisadineni@chromium.org>
+Date: Fri, 20 Apr 2018 11:08:21 -0700
+Subject: USB: Increment wakeup count on remote wakeup.
+
+From: Ravi Chandra Sadineni <ravisadineni@chromium.org>
+
+commit 83a62c51ba7b3c0bf45150c4eac7aefc6c785e94 upstream.
+
+On chromebooks we depend on wakeup count to identify the wakeup source.
+But currently USB devices do not increment the wakeup count when they
+trigger the remote wake. This patch addresses the same.
+
+Resume condition is reported differently on USB 2.0 and USB 3.0 devices.
+
+On USB 2.0 devices, a wake capable device, if wake enabled, drives
+resume signal to indicate a remote wake (USB 2.0 spec section 7.1.7.7).
+The upstream facing port then sets C_PORT_SUSPEND bit and reports a
+port change event (USB 2.0 spec section 11.24.2.7.2.3). Thus if a port
+has resumed before driving the resume signal from the host and
+C_PORT_SUSPEND is set, then the device attached to the given port might
+be the reason for the last system wakeup. Increment the wakeup count for
+the same.
+
+On USB 3.0 devices, a function may signal that it wants to exit from device
+suspend by sending a Function Wake Device Notification to the host (USB3.0
+spec section 8.5.6.4) Thus on receiving the Function Wake, increment the
+wakeup count.
+
+Signed-off-by: Ravi Chandra Sadineni <ravisadineni@chromium.org>
+Acked-by: Alan Stern <stern@rowland.harvard.edu>
+Cc: stable <stable@vger.kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/core/hcd.c |    1 +
+ drivers/usb/core/hub.c |   10 +++++++++-
+ 2 files changed, 10 insertions(+), 1 deletion(-)
+
+--- a/drivers/usb/core/hcd.c
++++ b/drivers/usb/core/hcd.c
+@@ -2365,6 +2365,7 @@ void usb_hcd_resume_root_hub (struct usb
+       spin_lock_irqsave (&hcd_root_hub_lock, flags);
+       if (hcd->rh_registered) {
++              pm_wakeup_event(&hcd->self.root_hub->dev, 0);
+               set_bit(HCD_FLAG_WAKEUP_PENDING, &hcd->flags);
+               queue_work(pm_wq, &hcd->wakeup_work);
+       }
+--- a/drivers/usb/core/hub.c
++++ b/drivers/usb/core/hub.c
+@@ -648,12 +648,17 @@ void usb_wakeup_notification(struct usb_
+               unsigned int portnum)
+ {
+       struct usb_hub *hub;
++      struct usb_port *port_dev;
+       if (!hdev)
+               return;
+       hub = usb_hub_to_struct_hub(hdev);
+       if (hub) {
++              port_dev = hub->ports[portnum - 1];
++              if (port_dev && port_dev->child)
++                      pm_wakeup_event(&port_dev->child->dev, 0);
++
+               set_bit(portnum, hub->wakeup_bits);
+               kick_hub_wq(hub);
+       }
+@@ -3417,8 +3422,11 @@ int usb_port_resume(struct usb_device *u
+       /* Skip the initial Clear-Suspend step for a remote wakeup */
+       status = hub_port_status(hub, port1, &portstatus, &portchange);
+-      if (status == 0 && !port_is_suspended(hub, portstatus))
++      if (status == 0 && !port_is_suspended(hub, portstatus)) {
++              if (portchange & USB_PORT_STAT_C_SUSPEND)
++                      pm_wakeup_event(&udev->dev, 0);
+               goto SuspendCleared;
++      }
+       /* see 7.1.7.7; affects power usage, but not budgeting */
+       if (hub_is_superspeed(hub->hdev))
diff --git a/queue-4.9/usb-serial-cp210x-add-id-for-ni-usb-serial-console.patch b/queue-4.9/usb-serial-cp210x-add-id-for-ni-usb-serial-console.patch
new file mode 100644 (file)
index 0000000..9da63da
--- /dev/null
@@ -0,0 +1,31 @@
+From 1e23aace21515a8f7615a1de016c0ea8d4e0cc6e Mon Sep 17 00:00:00 2001
+From: Kyle Roeschley <kyle.roeschley@ni.com>
+Date: Mon, 9 Apr 2018 10:23:55 -0500
+Subject: USB: serial: cp210x: add ID for NI USB serial console
+
+From: Kyle Roeschley <kyle.roeschley@ni.com>
+
+commit 1e23aace21515a8f7615a1de016c0ea8d4e0cc6e upstream.
+
+Added the USB VID and PID for the USB serial console on some National
+Instruments devices.
+
+Signed-off-by: Kyle Roeschley <kyle.roeschley@ni.com>
+Cc: stable <stable@vger.kernel.org>
+Signed-off-by: Johan Hovold <johan@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/serial/cp210x.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/usb/serial/cp210x.c
++++ b/drivers/usb/serial/cp210x.c
+@@ -211,6 +211,7 @@ static const struct usb_device_id id_tab
+       { USB_DEVICE(0x3195, 0xF190) }, /* Link Instruments MSO-19 */
+       { USB_DEVICE(0x3195, 0xF280) }, /* Link Instruments MSO-28 */
+       { USB_DEVICE(0x3195, 0xF281) }, /* Link Instruments MSO-28 */
++      { USB_DEVICE(0x3923, 0x7A0B) }, /* National Instruments USB Serial Console */
+       { USB_DEVICE(0x413C, 0x9500) }, /* DW700 GPS USB interface */
+       { } /* Terminating Entry */
+ };
diff --git a/queue-4.9/usb-serial-ftdi_sio-use-jtag-quirk-for-arrow-usb-blaster.patch b/queue-4.9/usb-serial-ftdi_sio-use-jtag-quirk-for-arrow-usb-blaster.patch
new file mode 100644 (file)
index 0000000..334c9f2
--- /dev/null
@@ -0,0 +1,37 @@
+From 470b5d6f0cf4674be2d1ec94e54283a1770b6a1a Mon Sep 17 00:00:00 2001
+From: Vasyl Vavrychuk <vvavrychuk@gmail.com>
+Date: Wed, 11 Apr 2018 17:05:13 +0300
+Subject: USB: serial: ftdi_sio: use jtag quirk for Arrow USB Blaster
+
+From: Vasyl Vavrychuk <vvavrychuk@gmail.com>
+
+commit 470b5d6f0cf4674be2d1ec94e54283a1770b6a1a upstream.
+
+Arrow USB Blaster integrated on MAX1000 board uses the same vendor ID
+(0x0403) and product ID (0x6010) as the "original" FTDI device.
+
+This patch avoids picking up by ftdi_sio of the first interface of this
+USB device. After that this device can be used by Arrow user-space JTAG
+driver.
+
+Signed-off-by: Vasyl Vavrychuk <vvavrychuk@gmail.com>
+Cc: stable <stable@vger.kernel.org>
+Signed-off-by: Johan Hovold <johan@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/serial/ftdi_sio.c |    3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/drivers/usb/serial/ftdi_sio.c
++++ b/drivers/usb/serial/ftdi_sio.c
+@@ -1911,7 +1911,8 @@ static int ftdi_8u2232c_probe(struct usb
+               return ftdi_jtag_probe(serial);
+       if (udev->product &&
+-              (!strcmp(udev->product, "BeagleBone/XDS100V2") ||
++              (!strcmp(udev->product, "Arrow USB Blaster") ||
++               !strcmp(udev->product, "BeagleBone/XDS100V2") ||
+                !strcmp(udev->product, "SNAP Connect E10")))
+               return ftdi_jtag_probe(serial);
diff --git a/queue-4.9/usb-serial-simple-add-libtransistor-console.patch b/queue-4.9/usb-serial-simple-add-libtransistor-console.patch
new file mode 100644 (file)
index 0000000..740c923
--- /dev/null
@@ -0,0 +1,63 @@
+From fe710508b6ba9d28730f3021fed70e7043433b2e Mon Sep 17 00:00:00 2001
+From: Collin May <collin@collinswebsite.com>
+Date: Sat, 7 Apr 2018 14:32:48 -0700
+Subject: USB: serial: simple: add libtransistor console
+
+From: Collin May <collin@collinswebsite.com>
+
+commit fe710508b6ba9d28730f3021fed70e7043433b2e upstream.
+
+Add simple driver for libtransistor USB console.
+This device is implemented in software:
+https://github.com/reswitched/libtransistor/blob/development/lib/usb_serial.c
+
+Signed-off-by: Collin May <collin@collinswebsite.com>
+Cc: stable <stable@vger.kernel.org>
+Signed-off-by: Johan Hovold <johan@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/serial/Kconfig             |    1 +
+ drivers/usb/serial/usb-serial-simple.c |    7 +++++++
+ 2 files changed, 8 insertions(+)
+
+--- a/drivers/usb/serial/Kconfig
++++ b/drivers/usb/serial/Kconfig
+@@ -62,6 +62,7 @@ config USB_SERIAL_SIMPLE
+               - Fundamental Software dongle.
+               - Google USB serial devices
+               - HP4x calculators
++              - Libtransistor USB console
+               - a number of Motorola phones
+               - Motorola Tetra devices
+               - Novatel Wireless GPS receivers
+--- a/drivers/usb/serial/usb-serial-simple.c
++++ b/drivers/usb/serial/usb-serial-simple.c
+@@ -66,6 +66,11 @@ DEVICE(flashloader, FLASHLOADER_IDS);
+                                       0x01) }
+ DEVICE(google, GOOGLE_IDS);
++/* Libtransistor USB console */
++#define LIBTRANSISTOR_IDS()                   \
++      { USB_DEVICE(0x1209, 0x8b00) }
++DEVICE(libtransistor, LIBTRANSISTOR_IDS);
++
+ /* ViVOpay USB Serial Driver */
+ #define VIVOPAY_IDS()                 \
+       { USB_DEVICE(0x1d5f, 0x1004) }  /* ViVOpay 8800 */
+@@ -113,6 +118,7 @@ static struct usb_serial_driver * const
+       &funsoft_device,
+       &flashloader_device,
+       &google_device,
++      &libtransistor_device,
+       &vivopay_device,
+       &moto_modem_device,
+       &motorola_tetra_device,
+@@ -129,6 +135,7 @@ static const struct usb_device_id id_tab
+       FUNSOFT_IDS(),
+       FLASHLOADER_IDS(),
+       GOOGLE_IDS(),
++      LIBTRANSISTOR_IDS(),
+       VIVOPAY_IDS(),
+       MOTO_IDS(),
+       MOTOROLA_TETRA_IDS(),
diff --git a/queue-4.9/usbip-usbip_event-fix-to-not-print-kernel-pointer-address.patch b/queue-4.9/usbip-usbip_event-fix-to-not-print-kernel-pointer-address.patch
new file mode 100644 (file)
index 0000000..fa90965
--- /dev/null
@@ -0,0 +1,33 @@
+From 4c982482341c64f55daf69b6caa5a2bcd9b43824 Mon Sep 17 00:00:00 2001
+From: Shuah Khan <shuahkh@osg.samsung.com>
+Date: Thu, 5 Apr 2018 16:29:50 -0600
+Subject: usbip: usbip_event: fix to not print kernel pointer address
+
+From: Shuah Khan <shuahkh@osg.samsung.com>
+
+commit 4c982482341c64f55daf69b6caa5a2bcd9b43824 upstream.
+
+Fix it to not print kernel pointer address. Remove the conditional
+and debug message as it isn't very useful.
+
+Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
+Cc: stable <stable@vger.kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/usbip/usbip_event.c |    4 ----
+ 1 file changed, 4 deletions(-)
+
+--- a/drivers/usb/usbip/usbip_event.c
++++ b/drivers/usb/usbip/usbip_event.c
+@@ -105,10 +105,6 @@ static void event_handler(struct work_st
+                       unset_event(ud, USBIP_EH_UNUSABLE);
+               }
+-              /* Stop the error handler. */
+-              if (ud->event & USBIP_EH_BYE)
+-                      usbip_dbg_eh("removed %p\n", ud);
+-
+               wake_up(&ud->eh_waitq);
+       }
+ }
diff --git a/queue-4.9/usbip-usbip_host-fix-to-hold-parent-lock-for-device_attach-calls.patch b/queue-4.9/usbip-usbip_host-fix-to-hold-parent-lock-for-device_attach-calls.patch
new file mode 100644 (file)
index 0000000..ebd79b4
--- /dev/null
@@ -0,0 +1,35 @@
+From 4bfb141bc01312a817d36627cc47c93f801c216d Mon Sep 17 00:00:00 2001
+From: Shuah Khan <shuahkh@osg.samsung.com>
+Date: Thu, 5 Apr 2018 16:29:04 -0600
+Subject: usbip: usbip_host: fix to hold parent lock for device_attach() calls
+
+From: Shuah Khan <shuahkh@osg.samsung.com>
+
+commit 4bfb141bc01312a817d36627cc47c93f801c216d upstream.
+
+usbip_host calls device_attach() without holding dev->parent lock.
+Fix it.
+
+Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
+Cc: stable <stable@vger.kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/usbip/stub_main.c |    5 +++++
+ 1 file changed, 5 insertions(+)
+
+--- a/drivers/usb/usbip/stub_main.c
++++ b/drivers/usb/usbip/stub_main.c
+@@ -201,7 +201,12 @@ static ssize_t rebind_store(struct devic
+       if (!bid)
+               return -ENODEV;
++      /* device_attach() callers should hold parent lock for USB */
++      if (bid->udev->dev.parent)
++              device_lock(bid->udev->dev.parent);
+       ret = device_attach(&bid->udev->dev);
++      if (bid->udev->dev.parent)
++              device_unlock(bid->udev->dev.parent);
+       if (ret < 0) {
+               dev_err(&bid->udev->dev, "rebind failed\n");
+               return ret;
diff --git a/queue-4.9/usbip-vhci_hcd-fix-usb-device-and-sockfd-leaks.patch b/queue-4.9/usbip-vhci_hcd-fix-usb-device-and-sockfd-leaks.patch
new file mode 100644 (file)
index 0000000..8093c9d
--- /dev/null
@@ -0,0 +1,31 @@
+From 9020a7efe537856eb3e826ebebdf38a5d07a7857 Mon Sep 17 00:00:00 2001
+From: Shuah Khan <shuahkh@osg.samsung.com>
+Date: Mon, 2 Apr 2018 14:52:32 -0600
+Subject: usbip: vhci_hcd: Fix usb device and sockfd leaks
+
+From: Shuah Khan <shuahkh@osg.samsung.com>
+
+commit 9020a7efe537856eb3e826ebebdf38a5d07a7857 upstream.
+
+vhci_hcd fails to do reset to put usb device and sockfd in the
+module remove/stop paths. Fix the leak.
+
+Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
+Cc: stable <stable@vger.kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/usbip/usbip_common.h |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/usb/usbip/usbip_common.h
++++ b/drivers/usb/usbip/usbip_common.h
+@@ -258,7 +258,7 @@ enum usbip_side {
+ #define       VUDC_EVENT_ERROR_USB    (USBIP_EH_SHUTDOWN | USBIP_EH_UNUSABLE)
+ #define       VUDC_EVENT_ERROR_MALLOC (USBIP_EH_SHUTDOWN | USBIP_EH_UNUSABLE)
+-#define       VDEV_EVENT_REMOVED      (USBIP_EH_SHUTDOWN | USBIP_EH_BYE)
++#define       VDEV_EVENT_REMOVED (USBIP_EH_SHUTDOWN | USBIP_EH_RESET | USBIP_EH_BYE)
+ #define       VDEV_EVENT_DOWN         (USBIP_EH_SHUTDOWN | USBIP_EH_RESET)
+ #define       VDEV_EVENT_ERROR_TCP    (USBIP_EH_SHUTDOWN | USBIP_EH_RESET)
+ #define       VDEV_EVENT_ERROR_MALLOC (USBIP_EH_SHUTDOWN | USBIP_EH_UNUSABLE)
diff --git a/queue-4.9/virtio-add-ability-to-iterate-over-vqs.patch b/queue-4.9/virtio-add-ability-to-iterate-over-vqs.patch
new file mode 100644 (file)
index 0000000..98c86cf
--- /dev/null
@@ -0,0 +1,32 @@
+From 24a7e4d20783c0514850f24a5c41ede46ab058f0 Mon Sep 17 00:00:00 2001
+From: "Michael S. Tsirkin" <mst@redhat.com>
+Date: Fri, 20 Apr 2018 20:22:40 +0300
+Subject: virtio: add ability to iterate over vqs
+
+From: Michael S. Tsirkin <mst@redhat.com>
+
+commit 24a7e4d20783c0514850f24a5c41ede46ab058f0 upstream.
+
+For cleanup it's helpful to be able to simply scan all vqs and discard
+all data. Add an iterator to do that.
+
+Cc: stable@vger.kernel.org
+Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ include/linux/virtio.h |    3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/include/linux/virtio.h
++++ b/include/linux/virtio.h
+@@ -143,6 +143,9 @@ int virtio_device_freeze(struct virtio_d
+ int virtio_device_restore(struct virtio_device *dev);
+ #endif
++#define virtio_device_for_each_vq(vdev, vq) \
++      list_for_each_entry(vq, &vdev->vqs, list)
++
+ /**
+  * virtio_driver - operations for a virtio I/O driver
+  * @driver: underlying device driver (populate name and owner).
diff --git a/queue-4.9/virtio_console-free-buffers-after-reset.patch b/queue-4.9/virtio_console-free-buffers-after-reset.patch
new file mode 100644 (file)
index 0000000..4778909
--- /dev/null
@@ -0,0 +1,142 @@
+From a7a69ec0d8e4a58be7db88d33cbfa2912807bb2b Mon Sep 17 00:00:00 2001
+From: "Michael S. Tsirkin" <mst@redhat.com>
+Date: Fri, 20 Apr 2018 20:24:23 +0300
+Subject: virtio_console: free buffers after reset
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Michael S. Tsirkin <mst@redhat.com>
+
+commit a7a69ec0d8e4a58be7db88d33cbfa2912807bb2b upstream.
+
+Console driver is out of spec. The spec says:
+       A driver MUST NOT decrement the available idx on a live
+       virtqueue (ie. there is no way to “unexpose” buffers).
+and it does exactly that by trying to detach unused buffers
+without doing a device reset first.
+
+Defer detaching the buffers until device unplug.
+
+Of course this means we might get an interrupt for
+a vq without an attached port now. Handle that by
+discarding the consumed buffer.
+
+Reported-by: Tiwei Bie <tiwei.bie@intel.com>
+Fixes: b3258ff1d6 ("virtio: Decrement avail idx on buffer detach")
+Cc: stable@vger.kernel.org
+Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/char/virtio_console.c |   49 ++++++++++++++++++++----------------------
+ 1 file changed, 24 insertions(+), 25 deletions(-)
+
+--- a/drivers/char/virtio_console.c
++++ b/drivers/char/virtio_console.c
+@@ -1405,7 +1405,6 @@ static int add_port(struct ports_device
+ {
+       char debugfs_name[16];
+       struct port *port;
+-      struct port_buffer *buf;
+       dev_t devt;
+       unsigned int nr_added_bufs;
+       int err;
+@@ -1516,8 +1515,6 @@ static int add_port(struct ports_device
+       return 0;
+ free_inbufs:
+-      while ((buf = virtqueue_detach_unused_buf(port->in_vq)))
+-              free_buf(buf, true);
+ free_device:
+       device_destroy(pdrvdata.class, port->dev->devt);
+ free_cdev:
+@@ -1542,34 +1539,14 @@ static void remove_port(struct kref *kre
+ static void remove_port_data(struct port *port)
+ {
+-      struct port_buffer *buf;
+-
+       spin_lock_irq(&port->inbuf_lock);
+       /* Remove unused data this port might have received. */
+       discard_port_data(port);
+       spin_unlock_irq(&port->inbuf_lock);
+-      /* Remove buffers we queued up for the Host to send us data in. */
+-      do {
+-              spin_lock_irq(&port->inbuf_lock);
+-              buf = virtqueue_detach_unused_buf(port->in_vq);
+-              spin_unlock_irq(&port->inbuf_lock);
+-              if (buf)
+-                      free_buf(buf, true);
+-      } while (buf);
+-
+       spin_lock_irq(&port->outvq_lock);
+       reclaim_consumed_buffers(port);
+       spin_unlock_irq(&port->outvq_lock);
+-
+-      /* Free pending buffers from the out-queue. */
+-      do {
+-              spin_lock_irq(&port->outvq_lock);
+-              buf = virtqueue_detach_unused_buf(port->out_vq);
+-              spin_unlock_irq(&port->outvq_lock);
+-              if (buf)
+-                      free_buf(buf, true);
+-      } while (buf);
+ }
+ /*
+@@ -1794,13 +1771,24 @@ static void control_work_handler(struct
+       spin_unlock(&portdev->c_ivq_lock);
+ }
++static void flush_bufs(struct virtqueue *vq, bool can_sleep)
++{
++      struct port_buffer *buf;
++      unsigned int len;
++
++      while ((buf = virtqueue_get_buf(vq, &len)))
++              free_buf(buf, can_sleep);
++}
++
+ static void out_intr(struct virtqueue *vq)
+ {
+       struct port *port;
+       port = find_port_by_vq(vq->vdev->priv, vq);
+-      if (!port)
++      if (!port) {
++              flush_bufs(vq, false);
+               return;
++      }
+       wake_up_interruptible(&port->waitqueue);
+ }
+@@ -1811,8 +1799,10 @@ static void in_intr(struct virtqueue *vq
+       unsigned long flags;
+       port = find_port_by_vq(vq->vdev->priv, vq);
+-      if (!port)
++      if (!port) {
++              flush_bufs(vq, false);
+               return;
++      }
+       spin_lock_irqsave(&port->inbuf_lock, flags);
+       port->inbuf = get_inbuf(port);
+@@ -1987,6 +1977,15 @@ static const struct file_operations port
+ static void remove_vqs(struct ports_device *portdev)
+ {
++      struct virtqueue *vq;
++
++      virtio_device_for_each_vq(portdev->vdev, vq) {
++              struct port_buffer *buf;
++
++              flush_bufs(vq, true);
++              while ((buf = virtqueue_detach_unused_buf(vq)))
++                      free_buf(buf, true);
++      }
+       portdev->vdev->config->del_vqs(portdev->vdev);
+       kfree(portdev->in_vqs);
+       kfree(portdev->out_vqs);