]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Oct 2019 13:40:41 +0000 (06:40 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Oct 2019 13:40:41 +0000 (06:40 -0700)
added patches:
media-stkwebcam-fix-runtime-pm-after-driver-unbind.patch
tracing-get-trace_array-reference-for-available_tracers-files.patch
x86-asm-fix-mwaitx-c-state-hint-value.patch

queue-4.4/media-stkwebcam-fix-runtime-pm-after-driver-unbind.patch [new file with mode: 0644]
queue-4.4/series
queue-4.4/tracing-get-trace_array-reference-for-available_tracers-files.patch [new file with mode: 0644]
queue-4.4/x86-asm-fix-mwaitx-c-state-hint-value.patch [new file with mode: 0644]

diff --git a/queue-4.4/media-stkwebcam-fix-runtime-pm-after-driver-unbind.patch b/queue-4.4/media-stkwebcam-fix-runtime-pm-after-driver-unbind.patch
new file mode 100644 (file)
index 0000000..ae533b3
--- /dev/null
@@ -0,0 +1,43 @@
+From 30045f2174aab7fb4db7a9cf902d0aa6c75856a7 Mon Sep 17 00:00:00 2001
+From: Johan Hovold <johan@kernel.org>
+Date: Tue, 1 Oct 2019 10:49:08 +0200
+Subject: media: stkwebcam: fix runtime PM after driver unbind
+
+From: Johan Hovold <johan@kernel.org>
+
+commit 30045f2174aab7fb4db7a9cf902d0aa6c75856a7 upstream.
+
+Since commit c2b71462d294 ("USB: core: Fix bug caused by duplicate
+interface PM usage counter") USB drivers must always balance their
+runtime PM gets and puts, including when the driver has already been
+unbound from the interface.
+
+Leaving the interface with a positive PM usage counter would prevent a
+later bound driver from suspending the device.
+
+Note that runtime PM has never actually been enabled for this driver
+since the support_autosuspend flag in its usb_driver struct is not set.
+
+Fixes: c2b71462d294 ("USB: core: Fix bug caused by duplicate interface PM usage counter")
+Cc: stable <stable@vger.kernel.org>
+Acked-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
+Signed-off-by: Johan Hovold <johan@kernel.org>
+Link: https://lore.kernel.org/r/20191001084908.2003-5-johan@kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/media/usb/stkwebcam/stk-webcam.c |    3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+--- a/drivers/media/usb/stkwebcam/stk-webcam.c
++++ b/drivers/media/usb/stkwebcam/stk-webcam.c
+@@ -642,8 +642,7 @@ static int v4l_stk_release(struct file *
+               dev->owner = NULL;
+       }
+-      if (is_present(dev))
+-              usb_autopm_put_interface(dev->interface);
++      usb_autopm_put_interface(dev->interface);
+       mutex_unlock(&dev->lock);
+       return v4l2_fh_release(fp);
+ }
index d7ef92c98fa504bd002b3f341086b6780a04844a..8d1e90d92263c9b412137a92e52016120e14e7ea 100644 (file)
@@ -75,3 +75,6 @@ arm64-rename-cpuid_feature-field-extract-routines.patch
 staging-fbtft-fix-memory-leak-in-fbtft_framebuffer_a.patch
 cifs-check-uniqueid-for-smb2-and-return-estale-if-ne.patch
 cifs-force-revalidate-inode-when-dentry-is-stale.patch
+media-stkwebcam-fix-runtime-pm-after-driver-unbind.patch
+tracing-get-trace_array-reference-for-available_tracers-files.patch
+x86-asm-fix-mwaitx-c-state-hint-value.patch
diff --git a/queue-4.4/tracing-get-trace_array-reference-for-available_tracers-files.patch b/queue-4.4/tracing-get-trace_array-reference-for-available_tracers-files.patch
new file mode 100644 (file)
index 0000000..2327cdc
--- /dev/null
@@ -0,0 +1,67 @@
+From 194c2c74f5532e62c218adeb8e2b683119503907 Mon Sep 17 00:00:00 2001
+From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
+Date: Fri, 11 Oct 2019 18:19:17 -0400
+Subject: tracing: Get trace_array reference for available_tracers files
+
+From: Steven Rostedt (VMware) <rostedt@goodmis.org>
+
+commit 194c2c74f5532e62c218adeb8e2b683119503907 upstream.
+
+As instances may have different tracers available, we need to look at the
+trace_array descriptor that shows the list of the available tracers for the
+instance. But there's a race between opening the file and an admin
+deleting the instance. The trace_array_get() needs to be called before
+accessing the trace_array.
+
+Cc: stable@vger.kernel.org
+Fixes: 607e2ea167e56 ("tracing: Set up infrastructure to allow tracers for instances")
+Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ kernel/trace/trace.c |   17 +++++++++++++++--
+ 1 file changed, 15 insertions(+), 2 deletions(-)
+
+--- a/kernel/trace/trace.c
++++ b/kernel/trace/trace.c
+@@ -3370,9 +3370,14 @@ static int show_traces_open(struct inode
+       if (tracing_disabled)
+               return -ENODEV;
++      if (trace_array_get(tr) < 0)
++              return -ENODEV;
++
+       ret = seq_open(file, &show_traces_seq_ops);
+-      if (ret)
++      if (ret) {
++              trace_array_put(tr);
+               return ret;
++      }
+       m = file->private_data;
+       m->private = tr;
+@@ -3380,6 +3385,14 @@ static int show_traces_open(struct inode
+       return 0;
+ }
++static int show_traces_release(struct inode *inode, struct file *file)
++{
++      struct trace_array *tr = inode->i_private;
++
++      trace_array_put(tr);
++      return seq_release(inode, file);
++}
++
+ static ssize_t
+ tracing_write_stub(struct file *filp, const char __user *ubuf,
+                  size_t count, loff_t *ppos)
+@@ -3410,8 +3423,8 @@ static const struct file_operations trac
+ static const struct file_operations show_traces_fops = {
+       .open           = show_traces_open,
+       .read           = seq_read,
+-      .release        = seq_release,
+       .llseek         = seq_lseek,
++      .release        = show_traces_release,
+ };
+ static ssize_t
diff --git a/queue-4.4/x86-asm-fix-mwaitx-c-state-hint-value.patch b/queue-4.4/x86-asm-fix-mwaitx-c-state-hint-value.patch
new file mode 100644 (file)
index 0000000..7cd3b6b
--- /dev/null
@@ -0,0 +1,64 @@
+From 454de1e7d970d6bc567686052329e4814842867c Mon Sep 17 00:00:00 2001
+From: Janakarajan Natarajan <Janakarajan.Natarajan@amd.com>
+Date: Mon, 7 Oct 2019 19:00:22 +0000
+Subject: x86/asm: Fix MWAITX C-state hint value
+
+From: Janakarajan Natarajan <Janakarajan.Natarajan@amd.com>
+
+commit 454de1e7d970d6bc567686052329e4814842867c upstream.
+
+As per "AMD64 Architecture Programmer's Manual Volume 3: General-Purpose
+and System Instructions", MWAITX EAX[7:4]+1 specifies the optional hint
+of the optimized C-state. For C0 state, EAX[7:4] should be set to 0xf.
+
+Currently, a value of 0xf is set for EAX[3:0] instead of EAX[7:4]. Fix
+this by changing MWAITX_DISABLE_CSTATES from 0xf to 0xf0.
+
+This hasn't had any implications so far because setting reserved bits in
+EAX is simply ignored by the CPU.
+
+ [ bp: Fixup comment in delay_mwaitx() and massage. ]
+
+Signed-off-by: Janakarajan Natarajan <Janakarajan.Natarajan@amd.com>
+Signed-off-by: Borislav Petkov <bp@suse.de>
+Cc: Frederic Weisbecker <frederic@kernel.org>
+Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Cc: "H. Peter Anvin" <hpa@zytor.com>
+Cc: Ingo Molnar <mingo@redhat.com>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: "x86@kernel.org" <x86@kernel.org>
+Cc: Zhenzhong Duan <zhenzhong.duan@oracle.com>
+Cc: <stable@vger.kernel.org>
+Link: https://lkml.kernel.org/r/20191007190011.4859-1-Janakarajan.Natarajan@amd.com
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/include/asm/mwait.h |    2 +-
+ arch/x86/lib/delay.c         |    4 ++--
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+--- a/arch/x86/include/asm/mwait.h
++++ b/arch/x86/include/asm/mwait.h
+@@ -19,7 +19,7 @@
+ #define MWAIT_ECX_INTERRUPT_BREAK     0x1
+ #define MWAITX_ECX_TIMER_ENABLE               BIT(1)
+ #define MWAITX_MAX_LOOPS              ((u32)-1)
+-#define MWAITX_DISABLE_CSTATES                0xf
++#define MWAITX_DISABLE_CSTATES                0xf0
+ static inline void __monitor(const void *eax, unsigned long ecx,
+                            unsigned long edx)
+--- a/arch/x86/lib/delay.c
++++ b/arch/x86/lib/delay.c
+@@ -112,8 +112,8 @@ static void delay_mwaitx(unsigned long _
+               __monitorx(this_cpu_ptr(&cpu_tss), 0, 0);
+               /*
+-               * AMD, like Intel, supports the EAX hint and EAX=0xf
+-               * means, do not enter any deep C-state and we use it
++               * AMD, like Intel's MWAIT version, supports the EAX hint and
++               * EAX=0xf0 means, do not enter any deep C-state and we use it
+                * here in delay() to minimize wakeup latency.
+                */
+               __mwaitx(MWAITX_DISABLE_CSTATES, delay, MWAITX_ECX_TIMER_ENABLE);