]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.14-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 21 Apr 2022 09:59:15 +0000 (11:59 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 21 Apr 2022 09:59:15 +0000 (11:59 +0200)
added patches:
can-usb_8dev-usb_8dev_start_xmit-fix-double-dev_kfree_skb-in-error-path.patch
tracing-dump-stacktrace-trigger-to-the-corresponding-instance.patch
tracing-have-traceon-and-traceoff-trigger-honor-the-instance.patch

queue-4.14/can-usb_8dev-usb_8dev_start_xmit-fix-double-dev_kfree_skb-in-error-path.patch [new file with mode: 0644]
queue-4.14/series
queue-4.14/tracing-dump-stacktrace-trigger-to-the-corresponding-instance.patch [new file with mode: 0644]
queue-4.14/tracing-have-traceon-and-traceoff-trigger-honor-the-instance.patch [new file with mode: 0644]

diff --git a/queue-4.14/can-usb_8dev-usb_8dev_start_xmit-fix-double-dev_kfree_skb-in-error-path.patch b/queue-4.14/can-usb_8dev-usb_8dev_start_xmit-fix-double-dev_kfree_skb-in-error-path.patch
new file mode 100644 (file)
index 0000000..b5d5394
--- /dev/null
@@ -0,0 +1,71 @@
+From 3d3925ff6433f98992685a9679613a2cc97f3ce2 Mon Sep 17 00:00:00 2001
+From: Hangyu Hua <hbh25y@gmail.com>
+Date: Fri, 11 Mar 2022 16:06:14 +0800
+Subject: can: usb_8dev: usb_8dev_start_xmit(): fix double dev_kfree_skb() in error path
+
+From: Hangyu Hua <hbh25y@gmail.com>
+
+commit 3d3925ff6433f98992685a9679613a2cc97f3ce2 upstream.
+
+There is no need to call dev_kfree_skb() when usb_submit_urb() fails
+because can_put_echo_skb() deletes original skb and
+can_free_echo_skb() deletes the cloned skb.
+
+Fixes: 0024d8ad1639 ("can: usb_8dev: Add support for USB2CAN interface from 8 devices")
+Link: https://lore.kernel.org/all/20220311080614.45229-1-hbh25y@gmail.com
+Cc: stable@vger.kernel.org
+Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
+Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
+[DP: adjusted params of can_free_echo_skb() for 4.14 stable]
+Signed-off-by: Dragos-Marian Panait <dragos.panait@windriver.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/can/usb/usb_8dev.c |   30 ++++++++++++++----------------
+ 1 file changed, 14 insertions(+), 16 deletions(-)
+
+--- a/drivers/net/can/usb/usb_8dev.c
++++ b/drivers/net/can/usb/usb_8dev.c
+@@ -681,9 +681,20 @@ static netdev_tx_t usb_8dev_start_xmit(s
+       atomic_inc(&priv->active_tx_urbs);
+       err = usb_submit_urb(urb, GFP_ATOMIC);
+-      if (unlikely(err))
+-              goto failed;
+-      else if (atomic_read(&priv->active_tx_urbs) >= MAX_TX_URBS)
++      if (unlikely(err)) {
++              can_free_echo_skb(netdev, context->echo_index);
++
++              usb_unanchor_urb(urb);
++              usb_free_coherent(priv->udev, size, buf, urb->transfer_dma);
++
++              atomic_dec(&priv->active_tx_urbs);
++
++              if (err == -ENODEV)
++                      netif_device_detach(netdev);
++              else
++                      netdev_warn(netdev, "failed tx_urb %d\n", err);
++              stats->tx_dropped++;
++      } else if (atomic_read(&priv->active_tx_urbs) >= MAX_TX_URBS)
+               /* Slow down tx path */
+               netif_stop_queue(netdev);
+@@ -702,19 +713,6 @@ nofreecontext:
+       return NETDEV_TX_BUSY;
+-failed:
+-      can_free_echo_skb(netdev, context->echo_index);
+-
+-      usb_unanchor_urb(urb);
+-      usb_free_coherent(priv->udev, size, buf, urb->transfer_dma);
+-
+-      atomic_dec(&priv->active_tx_urbs);
+-
+-      if (err == -ENODEV)
+-              netif_device_detach(netdev);
+-      else
+-              netdev_warn(netdev, "failed tx_urb %d\n", err);
+-
+ nomembuf:
+       usb_free_urb(urb);
index 74c2566da6a867dc8df4a698f99996044180fb7c..6000ff3fcc8e59cc6e7403be613e91506b806342 100644 (file)
@@ -1,2 +1,5 @@
 etherdevice-adjust-ether_addr-prototypes-to-silence-wstringop-overead.patch
 mm-page_alloc-fix-building-error-on-werror-array-compare.patch
+tracing-have-traceon-and-traceoff-trigger-honor-the-instance.patch
+tracing-dump-stacktrace-trigger-to-the-corresponding-instance.patch
+can-usb_8dev-usb_8dev_start_xmit-fix-double-dev_kfree_skb-in-error-path.patch
diff --git a/queue-4.14/tracing-dump-stacktrace-trigger-to-the-corresponding-instance.patch b/queue-4.14/tracing-dump-stacktrace-trigger-to-the-corresponding-instance.patch
new file mode 100644 (file)
index 0000000..d1e3ad1
--- /dev/null
@@ -0,0 +1,47 @@
+From ce33c845b030c9cf768370c951bc699470b09fa7 Mon Sep 17 00:00:00 2001
+From: Daniel Bristot de Oliveira <bristot@kernel.org>
+Date: Sun, 20 Feb 2022 23:49:57 +0100
+Subject: tracing: Dump stacktrace trigger to the corresponding instance
+
+From: Daniel Bristot de Oliveira <bristot@kernel.org>
+
+commit ce33c845b030c9cf768370c951bc699470b09fa7 upstream.
+
+The stacktrace event trigger is not dumping the stacktrace to the instance
+where it was enabled, but to the global "instance."
+
+Use the private_data, pointing to the trigger file, to figure out the
+corresponding trace instance, and use it in the trigger action, like
+snapshot_trigger does.
+
+Link: https://lkml.kernel.org/r/afbb0b4f18ba92c276865bc97204d438473f4ebc.1645396236.git.bristot@kernel.org
+
+Cc: stable@vger.kernel.org
+Fixes: ae63b31e4d0e2 ("tracing: Separate out trace events from global variables")
+Reviewed-by: Tom Zanussi <zanussi@kernel.org>
+Tested-by: Tom Zanussi <zanussi@kernel.org>
+Signed-off-by: Daniel Bristot de Oliveira <bristot@kernel.org>
+Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ kernel/trace/trace_events_trigger.c |    9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+--- a/kernel/trace/trace_events_trigger.c
++++ b/kernel/trace/trace_events_trigger.c
+@@ -1196,7 +1196,14 @@ static __init int register_trigger_snaps
+ static void
+ stacktrace_trigger(struct event_trigger_data *data, void *rec)
+ {
+-      trace_dump_stack(STACK_SKIP);
++      struct trace_event_file *file = data->private_data;
++      unsigned long flags;
++
++      if (file) {
++              local_save_flags(flags);
++              __trace_stack(file->tr, flags, STACK_SKIP, preempt_count());
++      } else
++              trace_dump_stack(STACK_SKIP);
+ }
+ static void
diff --git a/queue-4.14/tracing-have-traceon-and-traceoff-trigger-honor-the-instance.patch b/queue-4.14/tracing-have-traceon-and-traceoff-trigger-honor-the-instance.patch
new file mode 100644 (file)
index 0000000..be32cbe
--- /dev/null
@@ -0,0 +1,119 @@
+From 302e9edd54985f584cfc180098f3554774126969 Mon Sep 17 00:00:00 2001
+From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
+Date: Wed, 23 Feb 2022 22:38:37 -0500
+Subject: tracing: Have traceon and traceoff trigger honor the instance
+
+From: Steven Rostedt (Google) <rostedt@goodmis.org>
+
+commit 302e9edd54985f584cfc180098f3554774126969 upstream.
+
+If a trigger is set on an event to disable or enable tracing within an
+instance, then tracing should be disabled or enabled in the instance and
+not at the top level, which is confusing to users.
+
+Link: https://lkml.kernel.org/r/20220223223837.14f94ec3@rorschach.local.home
+
+Cc: stable@vger.kernel.org
+Fixes: ae63b31e4d0e2 ("tracing: Separate out trace events from global variables")
+Tested-by: Daniel Bristot de Oliveira <bristot@kernel.org>
+Reviewed-by: Tom Zanussi <zanussi@kernel.org>
+Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ kernel/trace/trace_events_trigger.c |   52 +++++++++++++++++++++++++++++++-----
+ 1 file changed, 46 insertions(+), 6 deletions(-)
+
+--- a/kernel/trace/trace_events_trigger.c
++++ b/kernel/trace/trace_events_trigger.c
+@@ -932,6 +932,16 @@ void set_named_trigger_data(struct event
+ static void
+ traceon_trigger(struct event_trigger_data *data, void *rec)
+ {
++      struct trace_event_file *file = data->private_data;
++
++      if (file) {
++              if (tracer_tracing_is_on(file->tr))
++                      return;
++
++              tracer_tracing_on(file->tr);
++              return;
++      }
++
+       if (tracing_is_on())
+               return;
+@@ -941,8 +951,15 @@ traceon_trigger(struct event_trigger_dat
+ static void
+ traceon_count_trigger(struct event_trigger_data *data, void *rec)
+ {
+-      if (tracing_is_on())
+-              return;
++      struct trace_event_file *file = data->private_data;
++
++      if (file) {
++              if (tracer_tracing_is_on(file->tr))
++                      return;
++      } else {
++              if (tracing_is_on())
++                      return;
++      }
+       if (!data->count)
+               return;
+@@ -950,12 +967,25 @@ traceon_count_trigger(struct event_trigg
+       if (data->count != -1)
+               (data->count)--;
+-      tracing_on();
++      if (file)
++              tracer_tracing_on(file->tr);
++      else
++              tracing_on();
+ }
+ static void
+ traceoff_trigger(struct event_trigger_data *data, void *rec)
+ {
++      struct trace_event_file *file = data->private_data;
++
++      if (file) {
++              if (!tracer_tracing_is_on(file->tr))
++                      return;
++
++              tracer_tracing_off(file->tr);
++              return;
++      }
++
+       if (!tracing_is_on())
+               return;
+@@ -965,8 +995,15 @@ traceoff_trigger(struct event_trigger_da
+ static void
+ traceoff_count_trigger(struct event_trigger_data *data, void *rec)
+ {
+-      if (!tracing_is_on())
+-              return;
++      struct trace_event_file *file = data->private_data;
++
++      if (file) {
++              if (!tracer_tracing_is_on(file->tr))
++                      return;
++      } else {
++              if (!tracing_is_on())
++                      return;
++      }
+       if (!data->count)
+               return;
+@@ -974,7 +1011,10 @@ traceoff_count_trigger(struct event_trig
+       if (data->count != -1)
+               (data->count)--;
+-      tracing_off();
++      if (file)
++              tracer_tracing_off(file->tr);
++      else
++              tracing_off();
+ }
+ static int