]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
3.18-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 27 Dec 2017 15:24:22 +0000 (16:24 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 27 Dec 2017 15:24:22 +0000 (16:24 +0100)
added patches:
acpi-apei-erst-fix-missing-error-handling-in-erst_reader.patch
alsa-rawmidi-avoid-racy-info-ioctl-via-ctl-device.patch
alsa-usb-audio-fix-the-missing-ctl-name-suffix-at-parsing-su.patch
crypto-mcryptd-protect-the-per-cpu-queue-with-a-lock.patch
kvm-x86-fix-load-rflags-w-o-the-fixed-bit.patch
mfd-cros-ec-spi-don-t-send-first-message-too-soon.patch
mfd-twl4030-audio-fix-sibling-node-lookup.patch
mfd-twl6040-fix-child-node-lookup.patch
net-mvneta-clear-interface-link-status-on-port-disable.patch
parisc-hide-diva-built-in-serial-aux-and-graphics-card.patch
pci-pm-force-devices-to-d0-in-pci_pm_thaw_noirq.patch
powerpc-perf-dereference-bhrb-entries-safely.patch

13 files changed:
queue-3.18/acpi-apei-erst-fix-missing-error-handling-in-erst_reader.patch [new file with mode: 0644]
queue-3.18/alsa-rawmidi-avoid-racy-info-ioctl-via-ctl-device.patch [new file with mode: 0644]
queue-3.18/alsa-usb-audio-fix-the-missing-ctl-name-suffix-at-parsing-su.patch [new file with mode: 0644]
queue-3.18/crypto-mcryptd-protect-the-per-cpu-queue-with-a-lock.patch [new file with mode: 0644]
queue-3.18/kvm-x86-fix-load-rflags-w-o-the-fixed-bit.patch [new file with mode: 0644]
queue-3.18/mfd-cros-ec-spi-don-t-send-first-message-too-soon.patch [new file with mode: 0644]
queue-3.18/mfd-twl4030-audio-fix-sibling-node-lookup.patch [new file with mode: 0644]
queue-3.18/mfd-twl6040-fix-child-node-lookup.patch [new file with mode: 0644]
queue-3.18/net-mvneta-clear-interface-link-status-on-port-disable.patch [new file with mode: 0644]
queue-3.18/parisc-hide-diva-built-in-serial-aux-and-graphics-card.patch [new file with mode: 0644]
queue-3.18/pci-pm-force-devices-to-d0-in-pci_pm_thaw_noirq.patch [new file with mode: 0644]
queue-3.18/powerpc-perf-dereference-bhrb-entries-safely.patch [new file with mode: 0644]
queue-3.18/series [new file with mode: 0644]

diff --git a/queue-3.18/acpi-apei-erst-fix-missing-error-handling-in-erst_reader.patch b/queue-3.18/acpi-apei-erst-fix-missing-error-handling-in-erst_reader.patch
new file mode 100644 (file)
index 0000000..7dc1161
--- /dev/null
@@ -0,0 +1,53 @@
+From bb82e0b4a7e96494f0c1004ce50cec3d7b5fb3d1 Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Thu, 14 Dec 2017 13:31:16 +0100
+Subject: ACPI: APEI / ERST: Fix missing error handling in erst_reader()
+
+From: Takashi Iwai <tiwai@suse.de>
+
+commit bb82e0b4a7e96494f0c1004ce50cec3d7b5fb3d1 upstream.
+
+The commit f6f828513290 ("pstore: pass allocated memory region back to
+caller") changed the check of the return value from erst_read() in
+erst_reader() in the following way:
+
+        if (len == -ENOENT)
+                goto skip;
+-       else if (len < 0) {
+-               rc = -1;
++       else if (len < sizeof(*rcd)) {
++               rc = -EIO;
+                goto out;
+
+This introduced another bug: since the comparison with sizeof() is
+cast to unsigned, a negative len value doesn't hit any longer.
+As a result, when an error is returned from erst_read(), the code
+falls through, and it may eventually lead to some weird thing like
+memory corruption.
+
+This patch adds the negative error value check more explicitly for
+addressing the issue.
+
+Fixes: f6f828513290 (pstore: pass allocated memory region back to caller)
+Tested-by: Jerry Tang <jtang@suse.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Acked-by: Kees Cook <keescook@chromium.org>
+Reviewed-by: Borislav Petkov <bp@suse.de>
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/acpi/apei/erst.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/acpi/apei/erst.c
++++ b/drivers/acpi/apei/erst.c
+@@ -1023,7 +1023,7 @@ skip:
+       /* The record may be cleared by others, try read next record */
+       if (len == -ENOENT)
+               goto skip;
+-      else if (len < sizeof(*rcd)) {
++      else if (len < 0 || len < sizeof(*rcd)) {
+               rc = -EIO;
+               goto out;
+       }
diff --git a/queue-3.18/alsa-rawmidi-avoid-racy-info-ioctl-via-ctl-device.patch b/queue-3.18/alsa-rawmidi-avoid-racy-info-ioctl-via-ctl-device.patch
new file mode 100644 (file)
index 0000000..f583ab1
--- /dev/null
@@ -0,0 +1,66 @@
+From c1cfd9025cc394fd137a01159d74335c5ac978ce Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Thu, 14 Dec 2017 16:44:12 +0100
+Subject: ALSA: rawmidi: Avoid racy info ioctl via ctl device
+
+From: Takashi Iwai <tiwai@suse.de>
+
+commit c1cfd9025cc394fd137a01159d74335c5ac978ce upstream.
+
+The rawmidi also allows to obtaining the information via ioctl of ctl
+API.  It means that user can issue an ioctl to the rawmidi device even
+when it's being removed as long as the control device is present.
+Although the code has some protection via the global register_mutex,
+its range is limited to the search of the corresponding rawmidi
+object, and the mutex is already unlocked at accessing the rawmidi
+object.  This may lead to a use-after-free.
+
+For avoiding it, this patch widens the application of register_mutex
+to the whole snd_rawmidi_info_select() function.  We have another
+mutex per rawmidi object, but this operation isn't very hot path, so
+it shouldn't matter from the performance POV.
+
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/core/rawmidi.c |   15 ++++++++++++---
+ 1 file changed, 12 insertions(+), 3 deletions(-)
+
+--- a/sound/core/rawmidi.c
++++ b/sound/core/rawmidi.c
+@@ -589,15 +589,14 @@ static int snd_rawmidi_info_user(struct
+       return 0;
+ }
+-int snd_rawmidi_info_select(struct snd_card *card, struct snd_rawmidi_info *info)
++static int __snd_rawmidi_info_select(struct snd_card *card,
++                                   struct snd_rawmidi_info *info)
+ {
+       struct snd_rawmidi *rmidi;
+       struct snd_rawmidi_str *pstr;
+       struct snd_rawmidi_substream *substream;
+-      mutex_lock(&register_mutex);
+       rmidi = snd_rawmidi_search(card, info->device);
+-      mutex_unlock(&register_mutex);
+       if (!rmidi)
+               return -ENXIO;
+       if (info->stream < 0 || info->stream > 1)
+@@ -613,6 +612,16 @@ int snd_rawmidi_info_select(struct snd_c
+       }
+       return -ENXIO;
+ }
++
++int snd_rawmidi_info_select(struct snd_card *card, struct snd_rawmidi_info *info)
++{
++      int ret;
++
++      mutex_lock(&register_mutex);
++      ret = __snd_rawmidi_info_select(card, info);
++      mutex_unlock(&register_mutex);
++      return ret;
++}
+ EXPORT_SYMBOL(snd_rawmidi_info_select);
+ static int snd_rawmidi_info_select_user(struct snd_card *card,
diff --git a/queue-3.18/alsa-usb-audio-fix-the-missing-ctl-name-suffix-at-parsing-su.patch b/queue-3.18/alsa-usb-audio-fix-the-missing-ctl-name-suffix-at-parsing-su.patch
new file mode 100644 (file)
index 0000000..46cd201
--- /dev/null
@@ -0,0 +1,75 @@
+From 5a15f289ee87eaf33f13f08a4909ec99d837ec5f Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Mon, 18 Dec 2017 23:36:57 +0100
+Subject: ALSA: usb-audio: Fix the missing ctl name suffix at parsing SU
+
+From: Takashi Iwai <tiwai@suse.de>
+
+commit 5a15f289ee87eaf33f13f08a4909ec99d837ec5f upstream.
+
+The commit 89b89d121ffc ("ALSA: usb-audio: Add check return value for
+usb_string()") added the check of the return value from
+snd_usb_copy_string_desc(), which is correct per se, but it introduced
+a regression.  In the original code, either the "Clock Source",
+"Playback Source" or "Capture Source" suffix is added after the
+terminal string, while the commit changed it to add the suffix only
+when get_term_name() is failing.  It ended up with an incorrect ctl
+name like "PCM" instead of "PCM Capture Source".
+
+Also, even the original code has a similar bug: when the ctl name is
+generated from snd_usb_copy_string_desc() for the given iSelector, it
+also doesn't put the suffix.
+
+This patch addresses these issues: the suffix is added always when no
+static mapping is found.  Also the patch tries to put more comments
+and cleans up the if/else block for better readability in order to
+avoid the same pitfall again.
+
+Fixes: 89b89d121ffc ("ALSA: usb-audio: Add check return value for usb_string()")
+Reported-and-tested-by: Mauro Santos <registo.mailling@gmail.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/usb/mixer.c |   27 ++++++++++++++++-----------
+ 1 file changed, 16 insertions(+), 11 deletions(-)
+
+--- a/sound/usb/mixer.c
++++ b/sound/usb/mixer.c
+@@ -2094,20 +2094,25 @@ static int parse_audio_selector_unit(str
+       kctl->private_value = (unsigned long)namelist;
+       kctl->private_free = usb_mixer_selector_elem_free;
+-      nameid = uac_selector_unit_iSelector(desc);
++      /* check the static mapping table at first */
+       len = check_mapped_name(map, kctl->id.name, sizeof(kctl->id.name));
+-      if (len)
+-              ;
+-      else if (nameid)
+-              len = snd_usb_copy_string_desc(state, nameid, kctl->id.name,
+-                                       sizeof(kctl->id.name));
+-      else
+-              len = get_term_name(state, &state->oterm,
+-                                  kctl->id.name, sizeof(kctl->id.name), 0);
+-
+       if (!len) {
+-              strlcpy(kctl->id.name, "USB", sizeof(kctl->id.name));
++              /* no mapping ? */
++              /* if iSelector is given, use it */
++              nameid = uac_selector_unit_iSelector(desc);
++              if (nameid)
++                      len = snd_usb_copy_string_desc(state, nameid,
++                                                     kctl->id.name,
++                                                     sizeof(kctl->id.name));
++              /* ... or pick up the terminal name at next */
++              if (!len)
++                      len = get_term_name(state, &state->oterm,
++                                  kctl->id.name, sizeof(kctl->id.name), 0);
++              /* ... or use the fixed string "USB" as the last resort */
++              if (!len)
++                      strlcpy(kctl->id.name, "USB", sizeof(kctl->id.name));
++              /* and add the proper suffix */
+               if (desc->bDescriptorSubtype == UAC2_CLOCK_SELECTOR)
+                       append_ctl_name(kctl, " Clock Source");
+               else if ((state->oterm.type & 0xff00) == 0x0100)
diff --git a/queue-3.18/crypto-mcryptd-protect-the-per-cpu-queue-with-a-lock.patch b/queue-3.18/crypto-mcryptd-protect-the-per-cpu-queue-with-a-lock.patch
new file mode 100644 (file)
index 0000000..03148b3
--- /dev/null
@@ -0,0 +1,113 @@
+From 9abffc6f2efe46c3564c04312e52e07622d40e51 Mon Sep 17 00:00:00 2001
+From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+Date: Thu, 30 Nov 2017 13:39:27 +0100
+Subject: crypto: mcryptd - protect the per-CPU queue with a lock
+
+From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+
+commit 9abffc6f2efe46c3564c04312e52e07622d40e51 upstream.
+
+mcryptd_enqueue_request() grabs the per-CPU queue struct and protects
+access to it with disabled preemption. Then it schedules a worker on the
+same CPU. The worker in mcryptd_queue_worker() guards access to the same
+per-CPU variable with disabled preemption.
+
+If we take CPU-hotplug into account then it is possible that between
+queue_work_on() and the actual invocation of the worker the CPU goes
+down and the worker will be scheduled on _another_ CPU. And here the
+preempt_disable() protection does not work anymore. The easiest thing is
+to add a spin_lock() to guard access to the list.
+
+Another detail: mcryptd_queue_worker() is not processing more than
+MCRYPTD_BATCH invocation in a row. If there are still items left, then
+it will invoke queue_work() to proceed with more later. *I* would
+suggest to simply drop that check because it does not use a system
+workqueue and the workqueue is already marked as "CPU_INTENSIVE". And if
+preemption is required then the scheduler should do it.
+However if queue_work() is used then the work item is marked as CPU
+unbound. That means it will try to run on the local CPU but it may run
+on another CPU as well. Especially with CONFIG_DEBUG_WQ_FORCE_RR_CPU=y.
+Again, the preempt_disable() won't work here but lock which was
+introduced will help.
+In order to keep work-item on the local CPU (and avoid RR) I changed it
+to queue_work_on().
+
+Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ crypto/mcryptd.c         |   23 ++++++++++-------------
+ include/crypto/mcryptd.h |    1 +
+ 2 files changed, 11 insertions(+), 13 deletions(-)
+
+--- a/crypto/mcryptd.c
++++ b/crypto/mcryptd.c
+@@ -80,6 +80,7 @@ static int mcryptd_init_queue(struct mcr
+               pr_debug("cpu_queue #%d %p\n", cpu, queue->cpu_queue);
+               crypto_init_queue(&cpu_queue->queue, max_cpu_qlen);
+               INIT_WORK(&cpu_queue->work, mcryptd_queue_worker);
++              spin_lock_init(&cpu_queue->q_lock);
+       }
+       return 0;
+ }
+@@ -103,15 +104,16 @@ static int mcryptd_enqueue_request(struc
+       int cpu, err;
+       struct mcryptd_cpu_queue *cpu_queue;
+-      cpu = get_cpu();
+-      cpu_queue = this_cpu_ptr(queue->cpu_queue);
+-      rctx->tag.cpu = cpu;
++      cpu_queue = raw_cpu_ptr(queue->cpu_queue);
++      spin_lock(&cpu_queue->q_lock);
++      cpu = smp_processor_id();
++      rctx->tag.cpu = smp_processor_id();
+       err = crypto_enqueue_request(&cpu_queue->queue, request);
+       pr_debug("enqueue request: cpu %d cpu_queue %p request %p\n",
+                cpu, cpu_queue, request);
++      spin_unlock(&cpu_queue->q_lock);
+       queue_work_on(cpu, kcrypto_wq, &cpu_queue->work);
+-      put_cpu();
+       return err;
+ }
+@@ -164,16 +166,11 @@ static void mcryptd_queue_worker(struct
+       cpu_queue = container_of(work, struct mcryptd_cpu_queue, work);
+       i = 0;
+       while (i < MCRYPTD_BATCH || single_task_running()) {
+-              /*
+-               * preempt_disable/enable is used to prevent
+-               * being preempted by mcryptd_enqueue_request()
+-               */
+-              local_bh_disable();
+-              preempt_disable();
++
++              spin_lock_bh(&cpu_queue->q_lock);
+               backlog = crypto_get_backlog(&cpu_queue->queue);
+               req = crypto_dequeue_request(&cpu_queue->queue);
+-              preempt_enable();
+-              local_bh_enable();
++              spin_unlock_bh(&cpu_queue->q_lock);
+               if (!req) {
+                       mcryptd_opportunistic_flush();
+@@ -188,7 +185,7 @@ static void mcryptd_queue_worker(struct
+               ++i;
+       }
+       if (cpu_queue->queue.qlen)
+-              queue_work(kcrypto_wq, &cpu_queue->work);
++              queue_work_on(smp_processor_id(), kcrypto_wq, &cpu_queue->work);
+ }
+ void mcryptd_flusher(struct work_struct *__work)
+--- a/include/crypto/mcryptd.h
++++ b/include/crypto/mcryptd.h
+@@ -26,6 +26,7 @@ static inline struct mcryptd_ahash *__mc
+ struct mcryptd_cpu_queue {
+       struct crypto_queue queue;
++      spinlock_t q_lock;
+       struct work_struct work;
+ };
diff --git a/queue-3.18/kvm-x86-fix-load-rflags-w-o-the-fixed-bit.patch b/queue-3.18/kvm-x86-fix-load-rflags-w-o-the-fixed-bit.patch
new file mode 100644 (file)
index 0000000..28d2fe2
--- /dev/null
@@ -0,0 +1,72 @@
+From d73235d17ba63b53dc0e1051dbc10a1f1be91b71 Mon Sep 17 00:00:00 2001
+From: Wanpeng Li <wanpeng.li@hotmail.com>
+Date: Thu, 7 Dec 2017 00:30:08 -0800
+Subject: KVM: X86: Fix load RFLAGS w/o the fixed bit
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Wanpeng Li <wanpeng.li@hotmail.com>
+
+commit d73235d17ba63b53dc0e1051dbc10a1f1be91b71 upstream.
+
+ *** Guest State ***
+ CR0: actual=0x0000000000000030, shadow=0x0000000060000010, gh_mask=fffffffffffffff7
+ CR4: actual=0x0000000000002050, shadow=0x0000000000000000, gh_mask=ffffffffffffe871
+ CR3 = 0x00000000fffbc000
+ RSP = 0x0000000000000000  RIP = 0x0000000000000000
+ RFLAGS=0x00000000         DR7 = 0x0000000000000400
+        ^^^^^^^^^^
+
+The failed vmentry is triggered by the following testcase when ept=Y:
+
+    #include <unistd.h>
+    #include <sys/syscall.h>
+    #include <string.h>
+    #include <stdint.h>
+    #include <linux/kvm.h>
+    #include <fcntl.h>
+    #include <sys/ioctl.h>
+
+    long r[5];
+    int main()
+    {
+       r[2] = open("/dev/kvm", O_RDONLY);
+       r[3] = ioctl(r[2], KVM_CREATE_VM, 0);
+       r[4] = ioctl(r[3], KVM_CREATE_VCPU, 7);
+       struct kvm_regs regs = {
+               .rflags = 0,
+       };
+       ioctl(r[4], KVM_SET_REGS, &regs);
+       ioctl(r[4], KVM_RUN, 0);
+    }
+
+X86 RFLAGS bit 1 is fixed set, userspace can simply clearing bit 1
+of RFLAGS with KVM_SET_REGS ioctl which results in vmentry fails.
+This patch fixes it by oring X86_EFLAGS_FIXED during ioctl.
+
+Suggested-by: Jim Mattson <jmattson@google.com>
+Reviewed-by: David Hildenbrand <david@redhat.com>
+Reviewed-by: Quan Xu <quan.xu0@gmail.com>
+Cc: Paolo Bonzini <pbonzini@redhat.com>
+Cc: Radim Krčmář <rkrcmar@redhat.com>
+Cc: Jim Mattson <jmattson@google.com>
+Signed-off-by: Wanpeng Li <wanpeng.li@hotmail.com>
+Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/kvm/x86.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/x86/kvm/x86.c
++++ b/arch/x86/kvm/x86.c
+@@ -6644,7 +6644,7 @@ int kvm_arch_vcpu_ioctl_set_regs(struct
+ #endif
+       kvm_rip_write(vcpu, regs->rip);
+-      kvm_set_rflags(vcpu, regs->rflags);
++      kvm_set_rflags(vcpu, regs->rflags | X86_EFLAGS_FIXED);
+       vcpu->arch.exception.pending = false;
diff --git a/queue-3.18/mfd-cros-ec-spi-don-t-send-first-message-too-soon.patch b/queue-3.18/mfd-cros-ec-spi-don-t-send-first-message-too-soon.patch
new file mode 100644 (file)
index 0000000..cd97981
--- /dev/null
@@ -0,0 +1,46 @@
+From 15d8374874ded0bec37ef27f8301a6d54032c0e5 Mon Sep 17 00:00:00 2001
+From: Jon Hunter <jonathanh@nvidia.com>
+Date: Tue, 14 Nov 2017 14:43:27 +0000
+Subject: mfd: cros ec: spi: Don't send first message too soon
+
+From: Jon Hunter <jonathanh@nvidia.com>
+
+commit 15d8374874ded0bec37ef27f8301a6d54032c0e5 upstream.
+
+On the Tegra124 Nyan-Big chromebook the very first SPI message sent to
+the EC is failing.
+
+The Tegra SPI driver configures the SPI chip-selects to be active-high
+by default (and always has for many years). The EC SPI requires an
+active-low chip-select and so the Tegra chip-select is reconfigured to
+be active-low when the EC SPI driver calls spi_setup(). The problem is
+that if the first SPI message to the EC is sent too soon after
+reconfiguring the SPI chip-select, it fails.
+
+The EC SPI driver prevents back-to-back SPI messages being sent too
+soon by keeping track of the time the last transfer was sent via the
+variable 'last_transfer_ns'. To prevent the very first transfer being
+sent too soon, initialise the 'last_transfer_ns' variable after calling
+spi_setup() and before sending the first SPI message.
+
+Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
+Reviewed-by: Brian Norris <briannorris@chromium.org>
+Reviewed-by: Douglas Anderson <dianders@chromium.org>
+Acked-by: Benson Leung <bleung@chromium.org>
+Signed-off-by: Lee Jones <lee.jones@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/mfd/cros_ec_spi.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/mfd/cros_ec_spi.c
++++ b/drivers/mfd/cros_ec_spi.c
+@@ -23,6 +23,7 @@
+ #include <linux/slab.h>
+ #include <linux/spi/spi.h>
++      ec_spi->last_transfer_ns = ktime_get_ns();
+ /* The header byte, which follows the preamble */
+ #define EC_MSG_HEADER                 0xec
diff --git a/queue-3.18/mfd-twl4030-audio-fix-sibling-node-lookup.patch b/queue-3.18/mfd-twl4030-audio-fix-sibling-node-lookup.patch
new file mode 100644 (file)
index 0000000..0058ece
--- /dev/null
@@ -0,0 +1,50 @@
+From 0a423772de2f3d7b00899987884f62f63ae00dcb Mon Sep 17 00:00:00 2001
+From: Johan Hovold <johan@kernel.org>
+Date: Sat, 11 Nov 2017 16:38:43 +0100
+Subject: mfd: twl4030-audio: Fix sibling-node lookup
+
+From: Johan Hovold <johan@kernel.org>
+
+commit 0a423772de2f3d7b00899987884f62f63ae00dcb upstream.
+
+A helper purported to look up a child node based on its name was using
+the wrong of-helper and ended up prematurely freeing the parent of-node
+while leaking any matching node.
+
+To make things worse, any matching node would not even necessarily be a
+child node as the whole device tree was searched depth-first starting at
+the parent.
+
+Fixes: 019a7e6b7b31 ("mfd: twl4030-audio: Add DT support")
+Signed-off-by: Johan Hovold <johan@kernel.org>
+Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
+Signed-off-by: Lee Jones <lee.jones@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/mfd/twl4030-audio.c |    9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+--- a/drivers/mfd/twl4030-audio.c
++++ b/drivers/mfd/twl4030-audio.c
+@@ -159,13 +159,18 @@ unsigned int twl4030_audio_get_mclk(void
+ EXPORT_SYMBOL_GPL(twl4030_audio_get_mclk);
+ static bool twl4030_audio_has_codec(struct twl4030_audio_data *pdata,
+-                            struct device_node *node)
++                            struct device_node *parent)
+ {
++      struct device_node *node;
++
+       if (pdata && pdata->codec)
+               return true;
+-      if (of_find_node_by_name(node, "codec"))
++      node = of_get_child_by_name(parent, "codec");
++      if (node) {
++              of_node_put(node);
+               return true;
++      }
+       return false;
+ }
diff --git a/queue-3.18/mfd-twl6040-fix-child-node-lookup.patch b/queue-3.18/mfd-twl6040-fix-child-node-lookup.patch
new file mode 100644 (file)
index 0000000..aa3c66e
--- /dev/null
@@ -0,0 +1,54 @@
+From 85e9b13cbb130a3209f21bd7933933399c389ffe Mon Sep 17 00:00:00 2001
+From: Johan Hovold <johan@kernel.org>
+Date: Sat, 11 Nov 2017 16:38:44 +0100
+Subject: mfd: twl6040: Fix child-node lookup
+
+From: Johan Hovold <johan@kernel.org>
+
+commit 85e9b13cbb130a3209f21bd7933933399c389ffe upstream.
+
+Fix child-node lookup during probe, which ended up searching the whole
+device tree depth-first starting at the parent rather than just matching
+on its children.
+
+To make things worse, the parent node was prematurely freed, while the
+child node was leaked.
+
+Note that the CONFIG_OF compile guard can be removed as
+of_get_child_by_name() provides a !CONFIG_OF implementation which always
+fails.
+
+Fixes: 37e13cecaa14 ("mfd: Add support for Device Tree to twl6040")
+Fixes: ca2cad6ae38e ("mfd: Fix twl6040 build failure")
+Signed-off-by: Johan Hovold <johan@kernel.org>
+Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
+Signed-off-by: Lee Jones <lee.jones@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/mfd/twl6040.c |   12 ++++++++----
+ 1 file changed, 8 insertions(+), 4 deletions(-)
+
+--- a/drivers/mfd/twl6040.c
++++ b/drivers/mfd/twl6040.c
+@@ -97,12 +97,16 @@ static struct reg_default twl6040_patch[
+ };
+-static bool twl6040_has_vibra(struct device_node *node)
++static bool twl6040_has_vibra(struct device_node *parent)
+ {
+-#ifdef CONFIG_OF
+-      if (of_find_node_by_name(node, "vibra"))
++      struct device_node *node;
++
++      node = of_get_child_by_name(parent, "vibra");
++      if (node) {
++              of_node_put(node);
+               return true;
+-#endif
++      }
++
+       return false;
+ }
diff --git a/queue-3.18/net-mvneta-clear-interface-link-status-on-port-disable.patch b/queue-3.18/net-mvneta-clear-interface-link-status-on-port-disable.patch
new file mode 100644 (file)
index 0000000..cf01311
--- /dev/null
@@ -0,0 +1,38 @@
+From 4423c18e466afdfb02a36ee8b9f901d144b3c607 Mon Sep 17 00:00:00 2001
+From: Yelena Krivosheev <yelena@marvell.com>
+Date: Tue, 19 Dec 2017 17:59:45 +0100
+Subject: net: mvneta: clear interface link status on port disable
+
+From: Yelena Krivosheev <yelena@marvell.com>
+
+commit 4423c18e466afdfb02a36ee8b9f901d144b3c607 upstream.
+
+When port connect to PHY in polling mode (with poll interval 1 sec),
+port and phy link status must be synchronize in order don't loss link
+change event.
+
+[gregory.clement@free-electrons.com: add fixes tag]
+Fixes: c5aff18204da ("net: mvneta: driver for Marvell Armada 370/XP network unit")
+Signed-off-by: Yelena Krivosheev <yelena@marvell.com>
+Tested-by: Dmitri Epshtein <dima@marvell.com>
+Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/net/ethernet/marvell/mvneta.c |    4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/drivers/net/ethernet/marvell/mvneta.c
++++ b/drivers/net/ethernet/marvell/mvneta.c
+@@ -851,6 +851,10 @@ static void mvneta_port_disable(struct m
+       val &= ~MVNETA_GMAC0_PORT_ENABLE;
+       mvreg_write(pp, MVNETA_GMAC_CTRL_0, val);
++      pp->link = 0;
++      pp->duplex = -1;
++      pp->speed = 0;
++
+       udelay(200);
+ }
diff --git a/queue-3.18/parisc-hide-diva-built-in-serial-aux-and-graphics-card.patch b/queue-3.18/parisc-hide-diva-built-in-serial-aux-and-graphics-card.patch
new file mode 100644 (file)
index 0000000..cb514b6
--- /dev/null
@@ -0,0 +1,60 @@
+From bcf3f1752a622f1372d3252d0fea8855d89812e7 Mon Sep 17 00:00:00 2001
+From: Helge Deller <deller@gmx.de>
+Date: Tue, 12 Dec 2017 21:52:26 +0100
+Subject: parisc: Hide Diva-built-in serial aux and graphics card
+
+From: Helge Deller <deller@gmx.de>
+
+commit bcf3f1752a622f1372d3252d0fea8855d89812e7 upstream.
+
+Diva GSP card has built-in serial AUX port and ATI graphic card which simply
+don't work and which both don't have external connectors.  User Guides even
+mention that those devices shouldn't be used.
+So, prevent that Linux drivers try to enable those devices.
+
+Signed-off-by: Helge Deller <deller@gmx.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/parisc/lba_pci.c |   33 +++++++++++++++++++++++++++++++++
+ 1 file changed, 33 insertions(+)
+
+--- a/drivers/parisc/lba_pci.c
++++ b/drivers/parisc/lba_pci.c
+@@ -1652,3 +1652,36 @@ void lba_set_iregs(struct parisc_device
+       iounmap(base_addr);
+ }
++
++/*
++ * The design of the Diva management card in rp34x0 machines (rp3410, rp3440)
++ * seems rushed, so that many built-in components simply don't work.
++ * The following quirks disable the serial AUX port and the built-in ATI RV100
++ * Radeon 7000 graphics card which both don't have any external connectors and
++ * thus are useless, and even worse, e.g. the AUX port occupies ttyS0 and as
++ * such makes those machines the only PARISC machines on which we can't use
++ * ttyS0 as boot console.
++ */
++static void quirk_diva_ati_card(struct pci_dev *dev)
++{
++      if (dev->subsystem_vendor != PCI_VENDOR_ID_HP ||
++          dev->subsystem_device != 0x1292)
++              return;
++
++      dev_info(&dev->dev, "Hiding Diva built-in ATI card");
++      dev->device = 0;
++}
++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_QY,
++      quirk_diva_ati_card);
++
++static void quirk_diva_aux_disable(struct pci_dev *dev)
++{
++      if (dev->subsystem_vendor != PCI_VENDOR_ID_HP ||
++          dev->subsystem_device != 0x1291)
++              return;
++
++      dev_info(&dev->dev, "Hiding Diva built-in AUX serial device");
++      dev->device = 0;
++}
++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_DIVA_AUX,
++      quirk_diva_aux_disable);
diff --git a/queue-3.18/pci-pm-force-devices-to-d0-in-pci_pm_thaw_noirq.patch b/queue-3.18/pci-pm-force-devices-to-d0-in-pci_pm_thaw_noirq.patch
new file mode 100644 (file)
index 0000000..14ac93f
--- /dev/null
@@ -0,0 +1,47 @@
+From 5839ee7389e893a31e4e3c9cf17b50d14103c902 Mon Sep 17 00:00:00 2001
+From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
+Date: Fri, 15 Dec 2017 03:07:18 +0100
+Subject: PCI / PM: Force devices to D0 in pci_pm_thaw_noirq()
+
+From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+
+commit 5839ee7389e893a31e4e3c9cf17b50d14103c902 upstream.
+
+It is incorrect to call pci_restore_state() for devices in low-power
+states (D1-D3), as that involves the restoration of MSI setup which
+requires MMIO to be operational and that is only the case in D0.
+
+However, pci_pm_thaw_noirq() may do that if the driver's "freeze"
+callbacks put the device into a low-power state, so fix it by making
+it force devices into D0 via pci_set_power_state() instead of trying
+to "update" their power state which is pointless.
+
+Fixes: e60514bd4485 (PCI/PM: Restore the status of PCI devices across hibernation)
+Reported-by: Thomas Gleixner <tglx@linutronix.de>
+Reported-by: Maarten Lankhorst <dev@mblankhorst.nl>
+Tested-by: Thomas Gleixner <tglx@linutronix.de>
+Tested-by: Maarten Lankhorst <dev@mblankhorst.nl>
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Acked-by: Bjorn Helgaas <bhelgaas@google.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/pci/pci-driver.c |    7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+--- a/drivers/pci/pci-driver.c
++++ b/drivers/pci/pci-driver.c
+@@ -924,7 +924,12 @@ static int pci_pm_thaw_noirq(struct devi
+       if (pci_has_legacy_pm_support(pci_dev))
+               return pci_legacy_resume_early(dev);
+-      pci_update_current_state(pci_dev, PCI_D0);
++      /*
++       * pci_restore_state() requires the device to be in D0 (because of MSI
++       * restoration among other things), so force it into D0 in case the
++       * driver's "freeze" callbacks put it into a low-power state directly.
++       */
++      pci_set_power_state(pci_dev, PCI_D0);
+       pci_restore_state(pci_dev);
+       if (drv && drv->pm && drv->pm->thaw_noirq)
diff --git a/queue-3.18/powerpc-perf-dereference-bhrb-entries-safely.patch b/queue-3.18/powerpc-perf-dereference-bhrb-entries-safely.patch
new file mode 100644 (file)
index 0000000..9a06889
--- /dev/null
@@ -0,0 +1,55 @@
+From f41d84dddc66b164ac16acf3f584c276146f1c48 Mon Sep 17 00:00:00 2001
+From: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
+Date: Tue, 12 Dec 2017 17:59:15 +0530
+Subject: powerpc/perf: Dereference BHRB entries safely
+
+From: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
+
+commit f41d84dddc66b164ac16acf3f584c276146f1c48 upstream.
+
+It's theoretically possible that branch instructions recorded in
+BHRB (Branch History Rolling Buffer) entries have already been
+unmapped before they are processed by the kernel. Hence, trying to
+dereference such memory location will result in a crash. eg:
+
+    Unable to handle kernel paging request for data at address 0xd000000019c41764
+    Faulting instruction address: 0xc000000000084a14
+    NIP [c000000000084a14] branch_target+0x4/0x70
+    LR [c0000000000eb828] record_and_restart+0x568/0x5c0
+    Call Trace:
+    [c0000000000eb3b4] record_and_restart+0xf4/0x5c0 (unreliable)
+    [c0000000000ec378] perf_event_interrupt+0x298/0x460
+    [c000000000027964] performance_monitor_exception+0x54/0x70
+    [c000000000009ba4] performance_monitor_common+0x114/0x120
+
+Fix it by deferefencing the addresses safely.
+
+Fixes: 691231846ceb ("powerpc/perf: Fix setting of "to" addresses for BHRB")
+Suggested-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
+Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
+Reviewed-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
+[mpe: Use probe_kernel_read() which is clearer, tweak change log]
+Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/powerpc/perf/core-book3s.c |    8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+--- a/arch/powerpc/perf/core-book3s.c
++++ b/arch/powerpc/perf/core-book3s.c
+@@ -396,8 +396,12 @@ static __u64 power_pmu_bhrb_to(u64 addr)
+       int ret;
+       __u64 target;
+-      if (is_kernel_addr(addr))
+-              return branch_target((unsigned int *)addr);
++      if (is_kernel_addr(addr)) {
++              if (probe_kernel_read(&instr, (void *)addr, sizeof(instr)))
++                      return 0;
++
++              return branch_target(&instr);
++      }
+       /* Userspace: need copy instruction here then translate it */
+       pagefault_disable();
diff --git a/queue-3.18/series b/queue-3.18/series
new file mode 100644 (file)
index 0000000..a943d30
--- /dev/null
@@ -0,0 +1,12 @@
+acpi-apei-erst-fix-missing-error-handling-in-erst_reader.patch
+crypto-mcryptd-protect-the-per-cpu-queue-with-a-lock.patch
+mfd-cros-ec-spi-don-t-send-first-message-too-soon.patch
+mfd-twl4030-audio-fix-sibling-node-lookup.patch
+mfd-twl6040-fix-child-node-lookup.patch
+alsa-rawmidi-avoid-racy-info-ioctl-via-ctl-device.patch
+alsa-usb-audio-fix-the-missing-ctl-name-suffix-at-parsing-su.patch
+pci-pm-force-devices-to-d0-in-pci_pm_thaw_noirq.patch
+parisc-hide-diva-built-in-serial-aux-and-graphics-card.patch
+kvm-x86-fix-load-rflags-w-o-the-fixed-bit.patch
+powerpc-perf-dereference-bhrb-entries-safely.patch
+net-mvneta-clear-interface-link-status-on-port-disable.patch