aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-10-16 06:44:49 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-10-16 06:44:49 -0700
commita57e5e25f2b76581dd6ff093a898e3bc02a4fcdd (patch)
treef22ebf07af0adce6d36c7ac296d2d2aba16c2316
parentb5a5a6d47158848d7dca98580a7c399a2322f2b9 (diff)
downloadqueue-3.18-a57e5e25f2b76581dd6ff093a898e3bc02a4fcdd.tar.gz
more
-rw-r--r--media-stkwebcam-fix-runtime-pm-after-driver-unbind.patch43
-rw-r--r--series2
-rw-r--r--tracing-get-trace_array-reference-for-available_tracers-files.patch67
3 files changed, 112 insertions, 0 deletions
diff --git a/media-stkwebcam-fix-runtime-pm-after-driver-unbind.patch b/media-stkwebcam-fix-runtime-pm-after-driver-unbind.patch
new file mode 100644
index 0000000..08731c9
--- /dev/null
+++ b/media-stkwebcam-fix-runtime-pm-after-driver-unbind.patch
@@ -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
+@@ -644,8 +644,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);
+ }
diff --git a/series b/series
index c264a17..2d1075b 100644
--- a/series
+++ b/series
@@ -32,3 +32,5 @@ usb-legousbtower-fix-open-after-failed-reset-request.patch
usb-legousbtower-fix-use-after-free-on-release.patch
iio-adc-ad799x-fix-probe-error-handling.patch
cifs-gracefully-handle-queryinfo-errors-during-open.patch
+media-stkwebcam-fix-runtime-pm-after-driver-unbind.patch
+tracing-get-trace_array-reference-for-available_tracers-files.patch
diff --git a/tracing-get-trace_array-reference-for-available_tracers-files.patch b/tracing-get-trace_array-reference-for-available_tracers-files.patch
new file mode 100644
index 0000000..4df624f
--- /dev/null
+++ b/tracing-get-trace_array-reference-for-available_tracers-files.patch
@@ -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
+@@ -3368,9 +3368,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;
+@@ -3378,6 +3383,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)
+@@ -3408,8 +3421,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,
+ };
+
+ /*