]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
3.10-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 4 Jul 2014 22:10:22 +0000 (15:10 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 4 Jul 2014 22:10:22 +0000 (15:10 -0700)
added patches:
alsa-hda-adjust-speaker-hpf-and-add-led-support-for-hp-spectre-13.patch
documentation-submittingpatches-describe-the-fixes-tag.patch
extcon-max77693-fix-two-null-pointer-exceptions-on-missing-pdata.patch
netfilter-ipt_ulog-fix-info-leaks.patch
tracing-fix-syscall_-regfunc-vs-copy_process-race.patch
tracing-try-again-for-saved-cmdline-if-failed-due-to-locking.patch

queue-3.10/alsa-hda-adjust-speaker-hpf-and-add-led-support-for-hp-spectre-13.patch [new file with mode: 0644]
queue-3.10/documentation-submittingpatches-describe-the-fixes-tag.patch [new file with mode: 0644]
queue-3.10/extcon-max77693-fix-two-null-pointer-exceptions-on-missing-pdata.patch [new file with mode: 0644]
queue-3.10/netfilter-ipt_ulog-fix-info-leaks.patch [new file with mode: 0644]
queue-3.10/series
queue-3.10/tracing-fix-syscall_-regfunc-vs-copy_process-race.patch [new file with mode: 0644]
queue-3.10/tracing-try-again-for-saved-cmdline-if-failed-due-to-locking.patch [new file with mode: 0644]

diff --git a/queue-3.10/alsa-hda-adjust-speaker-hpf-and-add-led-support-for-hp-spectre-13.patch b/queue-3.10/alsa-hda-adjust-speaker-hpf-and-add-led-support-for-hp-spectre-13.patch
new file mode 100644 (file)
index 0000000..4f35885
--- /dev/null
@@ -0,0 +1,134 @@
+From 8b3dfdaf0c25a584cb31d04d2574115cf2d422ab Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Tue, 24 Jun 2014 13:55:25 +0200
+Subject: ALSA: hda - Adjust speaker HPF and add LED support for HP Spectre 13
+
+From: Takashi Iwai <tiwai@suse.de>
+
+commit 8b3dfdaf0c25a584cb31d04d2574115cf2d422ab upstream.
+
+HP Spectre 13 has the IDT 92HD95 codec, and BIOS seems to set the
+default high-pass filter in some "safer" range, which results in the
+very soft tone from the built-in speakers in contrast to Windows.
+Also, the mute LED control is missing, since 92HD95 codec still has no
+HP-specific fixups for GPIO setups.
+
+This patch adds these missing features: the HPF is adjusted by the
+vendor-specific verb, and the LED is set up from a DMI string (but
+with the default polarity = 0 assumption due to the incomplete BIOS on
+the given machine).
+
+Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=74841
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ Documentation/sound/alsa/HD-Audio-Models.txt |    5 ++
+ sound/pci/hda/patch_sigmatel.c               |   58 ++++++++++++++++++++++++++-
+ 2 files changed, 62 insertions(+), 1 deletion(-)
+
+--- a/Documentation/sound/alsa/HD-Audio-Models.txt
++++ b/Documentation/sound/alsa/HD-Audio-Models.txt
+@@ -284,6 +284,11 @@ STAC92HD83*
+   hp-inv-led  HP with broken BIOS for inverted mute LED
+   auto                BIOS setup (default)
++STAC92HD95
++==========
++  hp-led      LED support for HP laptops
++  hp-bass     Bass HPF setup for HP Spectre 13
++
+ STAC9872
+ ========
+   vaio                VAIO laptop without SPDIF
+--- a/sound/pci/hda/patch_sigmatel.c
++++ b/sound/pci/hda/patch_sigmatel.c
+@@ -121,6 +121,12 @@ enum {
+ };
+ enum {
++      STAC_92HD95_HP_LED,
++      STAC_92HD95_HP_BASS,
++      STAC_92HD95_MODELS
++};
++
++enum {
+       STAC_925x_REF,
+       STAC_M1,
+       STAC_M1_2,
+@@ -3560,6 +3566,48 @@ static const struct snd_pci_quirk stac92
+       {} /* terminator */
+ };
++static void stac92hd95_fixup_hp_led(struct hda_codec *codec,
++                                  const struct hda_fixup *fix, int action)
++{
++      struct sigmatel_spec *spec = codec->spec;
++
++      if (action != HDA_FIXUP_ACT_PRE_PROBE)
++              return;
++
++      if (find_mute_led_cfg(codec, spec->default_polarity))
++              codec_dbg(codec, "mute LED gpio %d polarity %d\n",
++                              spec->gpio_led,
++                              spec->gpio_led_polarity);
++}
++
++static const struct hda_fixup stac92hd95_fixups[] = {
++      [STAC_92HD95_HP_LED] = {
++              .type = HDA_FIXUP_FUNC,
++              .v.func = stac92hd95_fixup_hp_led,
++      },
++      [STAC_92HD95_HP_BASS] = {
++              .type = HDA_FIXUP_VERBS,
++              .v.verbs = (const struct hda_verb[]) {
++                      {0x1a, 0x795, 0x00}, /* HPF to 100Hz */
++                      {}
++              },
++              .chained = true,
++              .chain_id = STAC_92HD95_HP_LED,
++      },
++};
++
++static const struct snd_pci_quirk stac92hd95_fixup_tbl[] = {
++      SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1911, "HP Spectre 13", STAC_92HD95_HP_BASS),
++      {} /* terminator */
++};
++
++static const struct hda_model_fixup stac92hd95_models[] = {
++      { .id = STAC_92HD95_HP_LED, .name = "hp-led" },
++      { .id = STAC_92HD95_HP_BASS, .name = "hp-bass" },
++      {}
++};
++
++
+ static int stac_parse_auto_config(struct hda_codec *codec)
+ {
+       struct sigmatel_spec *spec = codec->spec;
+@@ -4045,10 +4093,16 @@ static int patch_stac92hd95(struct hda_c
+       spec->gen.beep_nid = 0x19; /* digital beep */
+       spec->pwr_nids = stac92hd95_pwr_nids;
+       spec->num_pwrs = ARRAY_SIZE(stac92hd95_pwr_nids);
+-      spec->default_polarity = -1; /* no default cfg */
++      spec->default_polarity = 0;
+       codec->patch_ops = stac_patch_ops;
++      snd_hda_pick_fixup(codec, stac92hd95_models, stac92hd95_fixup_tbl,
++                         stac92hd95_fixups);
++      snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
++
++      stac_setup_gpio(codec);
++
+       err = stac_parse_auto_config(codec);
+       if (err < 0) {
+               stac_free(codec);
+@@ -4057,6 +4111,8 @@ static int patch_stac92hd95(struct hda_c
+       codec->proc_widget_hook = stac92hd_proc_hook;
++      snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
++
+       return 0;
+ }
diff --git a/queue-3.10/documentation-submittingpatches-describe-the-fixes-tag.patch b/queue-3.10/documentation-submittingpatches-describe-the-fixes-tag.patch
new file mode 100644 (file)
index 0000000..c3a39e2
--- /dev/null
@@ -0,0 +1,70 @@
+From 8401aa1f59975c03eeebd3ac6d264cbdfe9af5de Mon Sep 17 00:00:00 2001
+From: Jacob Keller <jacob.e.keller@intel.com>
+Date: Fri, 6 Jun 2014 14:36:39 -0700
+Subject: Documentation/SubmittingPatches: describe the Fixes: tag
+
+From: Jacob Keller <jacob.e.keller@intel.com>
+
+commit 8401aa1f59975c03eeebd3ac6d264cbdfe9af5de upstream.
+
+Update the SubmittingPatches process to include howto about the new
+'Fixes:' tag to be used when a patch fixes an issue in a previous commit
+(found by git-bisect for example).
+
+Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
+Tested-by: Aaron Brown <aaron.f.brown@intel.com>
+Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
+Cc: Randy Dunlap <rdunlap@infradead.org>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ Documentation/SubmittingPatches |   22 +++++++++++++++++++++-
+ 1 file changed, 21 insertions(+), 1 deletion(-)
+
+--- a/Documentation/SubmittingPatches
++++ b/Documentation/SubmittingPatches
+@@ -131,6 +131,20 @@ If you cannot condense your patch set in
+ then only post say 15 or so at a time and wait for review and integration.
++If your patch fixes a bug in a specific commit, e.g. you found an issue using
++git-bisect, please use the 'Fixes:' tag with the first 12 characters of the
++SHA-1 ID, and the one line summary.
++Example:
++
++      Fixes: e21d2170f366 ("video: remove unnecessary platform_set_drvdata()")
++
++The following git-config settings can be used to add a pretty format for
++outputting the above style in the git log or git show commands
++
++      [core]
++              abbrev = 12
++      [pretty]
++              fixes = Fixes: %h (\"%s\")
+ 4) Style check your changes.
+@@ -420,7 +434,7 @@ person it names.  This tag documents tha
+ have been included in the discussion
+-14) Using Reported-by:, Tested-by:, Reviewed-by: and Suggested-by:
++14) Using Reported-by:, Tested-by:, Reviewed-by:, Suggested-by: and Fixes:
+ If this patch fixes a problem reported by somebody else, consider adding a
+ Reported-by: tag to credit the reporter for their contribution.  Please
+@@ -475,6 +489,12 @@ idea was not posted in a public forum. T
+ idea reporters, they will, hopefully, be inspired to help us again in the
+ future.
++A Fixes: tag indicates that the patch fixes an issue in a previous commit. It
++is used to make it easy to determine where a bug originated, which can help
++review a bug fix. This tag also assists the stable kernel team in determining
++which stable kernel versions should receive your fix. This is the preferred
++method for indicating a bug fixed by the patch. See #2 above for more details.
++
+ 15) The canonical patch format
diff --git a/queue-3.10/extcon-max77693-fix-two-null-pointer-exceptions-on-missing-pdata.patch b/queue-3.10/extcon-max77693-fix-two-null-pointer-exceptions-on-missing-pdata.patch
new file mode 100644 (file)
index 0000000..348a11c
--- /dev/null
@@ -0,0 +1,87 @@
+From d5653f2b7304f05eeb45d84f123cf02f840b8537 Mon Sep 17 00:00:00 2001
+From: Krzysztof Kozlowski <k.kozlowski@samsung.com>
+Date: Wed, 9 Apr 2014 15:20:12 +0200
+Subject: extcon: max77693: Fix two NULL pointer exceptions on missing pdata
+
+From: Krzysztof Kozlowski <k.kozlowski@samsung.com>
+
+commit d5653f2b7304f05eeb45d84f123cf02f840b8537 upstream.
+
+Fix NULL pointer exceptions when platform data is not supplied.
+
+Trace of one exception:
+Unable to handle kernel NULL pointer dereference at virtual address 00000008
+pgd = c0004000
+[00000008] *pgd=00000000
+Internal error: Oops: 5 [#1] PREEMPT SMP ARM
+Modules linked in:
+CPU: 2 PID: 1 Comm: swapper/0 Not tainted 3.14.0-12045-gead5dd4687a6-dirty #1628
+task: eea80000 ti: eea88000 task.ti: eea88000
+PC is at max77693_muic_probe+0x27c/0x528
+LR is at regmap_write+0x50/0x60
+pc : [<c041d1c8>]    lr : [<c02eba60>]    psr: 20000113
+sp : eea89e38  ip : 00000000  fp : c098a834
+r10: ee1a5a10  r9 : 00000005  r8 : c098a83c
+r7 : 0000000a  r6 : c098a774  r5 : 00000005  r4 : eeb006d0
+r3 : c0697bd8  r2 : 00000000  r1 : 00000001  r0 : 00000000
+Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
+Control: 10c5387d  Table: 4000404a  DAC: 00000015
+Process swapper/0 (pid: 1, stack limit = 0xeea88240)
+Stack: (0xeea89e38 to 0xeea8a000)
+9e20:                                                       c08499fc eeb006d0
+9e40: 00000000 00000000 c0915f98 00000001 00000000 ee1a5a10 c098a730 c09a88b8
+9e60: 00000000 c098a730 c0915f98 00000000 00000000 c02d6aa0 c02d6a88 ee1a5a10
+9e80: c0a712c8 c02d54e4 00001204 c0628b00 ee1a5a10 c098a730 ee1a5a44 00000000
+9ea0: eea88000 c02d57b4 00000000 c098a730 c02d5728 c02d3a24 ee813e5c eeb9d534
+9ec0: c098a730 ee22f700 c097c720 c02d4b14 c08174ec c098a730 00000006 c098a730
+9ee0: 00000006 c092fd30 c09b8500 c02d5df8 00000000 c093cbb8 00000006 c0008928
+9f00: 000000c3 ef7fc785 00000000 ef7fc794 00000000 c08af968 00000072 eea89f30
+9f20: ef7fc85e c065f198 000000c3 c003e87c 00000003 00000000 c092fd3c 00000000
+9f40: c08af618 c0826d58 00000006 00000006 c0956f58 c093cbb8 00000006 c092fd30
+9f60: c09b8500 000000c3 c092fd3c c08e8510 00000000 c08e8bb0 00000006 00000006
+9f80: c08e8510 c0c0c0c0 00000000 c0628fac 00000000 00000000 00000000 00000000
+9fa0: 00000000 c0628fb4 00000000 c000f038 00000000 00000000 00000000 00000000
+9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
+9fe0: 00000000 00000000 00000000 00000000 00000013 00000000 c0c0c0c0 c0c0c0c0
+[<c041d1c8>] (max77693_muic_probe) from [<c02d6aa0>] (platform_drv_probe+0x18/0x48)
+[<c02d6aa0>] (platform_drv_probe) from [<c02d54e4>] (driver_probe_device+0x140/0x384)
+[<c02d54e4>] (driver_probe_device) from [<c02d57b4>] (__driver_attach+0x8c/0x90)
+[<c02d57b4>] (__driver_attach) from [<c02d3a24>] (bus_for_each_dev+0x54/0x88)
+[<c02d3a24>] (bus_for_each_dev) from [<c02d4b14>] (bus_add_driver+0xe8/0x204)
+[<c02d4b14>] (bus_add_driver) from [<c02d5df8>] (driver_register+0x78/0xf4)
+[<c02d5df8>] (driver_register) from [<c0008928>] (do_one_initcall+0xc4/0x174)
+[<c0008928>] (do_one_initcall) from [<c08e8bb0>] (kernel_init_freeable+0xfc/0x1c8)
+[<c08e8bb0>] (kernel_init_freeable) from [<c0628fb4>] (kernel_init+0x8/0xec)
+[<c0628fb4>] (kernel_init) from [<c000f038>] (ret_from_fork+0x14/0x3c)
+Code: caffffe7 e59d200c e3550001 b3a05001 (e5923008)
+---[ end trace 85db969ce011bde7 ]---
+
+Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
+Fixes: 190d7cfc8632
+Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/extcon/extcon-max77693.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/extcon/extcon-max77693.c
++++ b/drivers/extcon/extcon-max77693.c
+@@ -1180,7 +1180,7 @@ static int max77693_muic_probe(struct pl
+       /* Initialize MUIC register by using platform data or default data */
+-      if (pdata->muic_data) {
++      if (pdata && pdata->muic_data) {
+               init_data = pdata->muic_data->init_data;
+               num_init_data = pdata->muic_data->num_init_data;
+       } else {
+@@ -1213,7 +1213,7 @@ static int max77693_muic_probe(struct pl
+                               = init_data[i].data;
+       }
+-      if (pdata->muic_data) {
++      if (pdata && pdata->muic_data) {
+               struct max77693_muic_platform_data *muic_pdata = pdata->muic_data;
+               /*
diff --git a/queue-3.10/netfilter-ipt_ulog-fix-info-leaks.patch b/queue-3.10/netfilter-ipt_ulog-fix-info-leaks.patch
new file mode 100644 (file)
index 0000000..8d4403b
--- /dev/null
@@ -0,0 +1,55 @@
+From 278f2b3e2af5f32ea1afe34fa12a2518153e6e49 Mon Sep 17 00:00:00 2001
+From: Mathias Krause <minipli@googlemail.com>
+Date: Mon, 30 Sep 2013 22:05:08 +0200
+Subject: netfilter: ipt_ULOG: fix info leaks
+
+From: Mathias Krause <minipli@googlemail.com>
+
+commit 278f2b3e2af5f32ea1afe34fa12a2518153e6e49 upstream.
+
+The ulog messages leak heap bytes by the means of padding bytes and
+incompletely filled string arrays. Fix those by memset(0)'ing the
+whole struct before filling it.
+
+Signed-off-by: Mathias Krause <minipli@googlemail.com>
+Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
+Cc: Jan Tore Morken <jantore@morken.priv.no>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ net/ipv4/netfilter/ipt_ULOG.c |    7 +------
+ 1 file changed, 1 insertion(+), 6 deletions(-)
+
+--- a/net/ipv4/netfilter/ipt_ULOG.c
++++ b/net/ipv4/netfilter/ipt_ULOG.c
+@@ -220,6 +220,7 @@ static void ipt_ulog_packet(struct net *
+       ub->qlen++;
+       pm = nlmsg_data(nlh);
++      memset(pm, 0, sizeof(*pm));
+       /* We might not have a timestamp, get one */
+       if (skb->tstamp.tv64 == 0)
+@@ -238,8 +239,6 @@ static void ipt_ulog_packet(struct net *
+       }
+       else if (loginfo->prefix[0] != '\0')
+               strncpy(pm->prefix, loginfo->prefix, sizeof(pm->prefix));
+-      else
+-              *(pm->prefix) = '\0';
+       if (in && in->hard_header_len > 0 &&
+           skb->mac_header != skb->network_header &&
+@@ -251,13 +250,9 @@ static void ipt_ulog_packet(struct net *
+       if (in)
+               strncpy(pm->indev_name, in->name, sizeof(pm->indev_name));
+-      else
+-              pm->indev_name[0] = '\0';
+       if (out)
+               strncpy(pm->outdev_name, out->name, sizeof(pm->outdev_name));
+-      else
+-              pm->outdev_name[0] = '\0';
+       /* copy_len <= skb->len, so can't fail. */
+       if (skb_copy_bits(skb, 0, pm->payload, copy_len) < 0)
index 89fadae3c353c41791e2f4537d9583fc22834372..b91771d1a98b596dffb1fab1452ca67359d9dd8e 100644 (file)
@@ -38,3 +38,9 @@ ipvs-fix-panic-due-to-non-linear-skb.patch
 ptrace-x86-force-iret-path-after-a-ptrace_stop.patch
 mei-me-read-h_csr-after-asserting-reset.patch
 mei-me-fix-hw-ready-reset-flow.patch
+extcon-max77693-fix-two-null-pointer-exceptions-on-missing-pdata.patch
+netfilter-ipt_ulog-fix-info-leaks.patch
+documentation-submittingpatches-describe-the-fixes-tag.patch
+tracing-try-again-for-saved-cmdline-if-failed-due-to-locking.patch
+tracing-fix-syscall_-regfunc-vs-copy_process-race.patch
+alsa-hda-adjust-speaker-hpf-and-add-led-support-for-hp-spectre-13.patch
diff --git a/queue-3.10/tracing-fix-syscall_-regfunc-vs-copy_process-race.patch b/queue-3.10/tracing-fix-syscall_-regfunc-vs-copy_process-race.patch
new file mode 100644 (file)
index 0000000..0215583
--- /dev/null
@@ -0,0 +1,72 @@
+From 4af4206be2bd1933cae20c2b6fb2058dbc887f7c Mon Sep 17 00:00:00 2001
+From: Oleg Nesterov <oleg@redhat.com>
+Date: Sun, 13 Apr 2014 20:58:54 +0200
+Subject: tracing: Fix syscall_*regfunc() vs copy_process() race
+
+From: Oleg Nesterov <oleg@redhat.com>
+
+commit 4af4206be2bd1933cae20c2b6fb2058dbc887f7c upstream.
+
+syscall_regfunc() and syscall_unregfunc() should set/clear
+TIF_SYSCALL_TRACEPOINT system-wide, but do_each_thread() can race
+with copy_process() and miss the new child which was not added to
+the process/thread lists yet.
+
+Change copy_process() to update the child's TIF_SYSCALL_TRACEPOINT
+under tasklist.
+
+Link: http://lkml.kernel.org/p/20140413185854.GB20668@redhat.com
+
+Fixes: a871bd33a6c0 "tracing: Add syscall tracepoints"
+Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
+Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
+Signed-off-by: Oleg Nesterov <oleg@redhat.com>
+Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ include/trace/syscall.h |   15 +++++++++++++++
+ kernel/fork.c           |    2 ++
+ 2 files changed, 17 insertions(+)
+
+--- a/include/trace/syscall.h
++++ b/include/trace/syscall.h
+@@ -4,6 +4,7 @@
+ #include <linux/tracepoint.h>
+ #include <linux/unistd.h>
+ #include <linux/ftrace_event.h>
++#include <linux/thread_info.h>
+ #include <asm/ptrace.h>
+@@ -31,4 +32,18 @@ struct syscall_metadata {
+       struct ftrace_event_call *exit_event;
+ };
++#if defined(CONFIG_TRACEPOINTS) && defined(CONFIG_HAVE_SYSCALL_TRACEPOINTS)
++static inline void syscall_tracepoint_update(struct task_struct *p)
++{
++      if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
++              set_tsk_thread_flag(p, TIF_SYSCALL_TRACEPOINT);
++      else
++              clear_tsk_thread_flag(p, TIF_SYSCALL_TRACEPOINT);
++}
++#else
++static inline void syscall_tracepoint_update(struct task_struct *p)
++{
++}
++#endif
++
+ #endif /* _TRACE_SYSCALL_H */
+--- a/kernel/fork.c
++++ b/kernel/fork.c
+@@ -1479,7 +1479,9 @@ static struct task_struct *copy_process(
+       total_forks++;
+       spin_unlock(&current->sighand->siglock);
++      syscall_tracepoint_update(p);
+       write_unlock_irq(&tasklist_lock);
++
+       proc_fork_connector(p);
+       cgroup_post_fork(p);
+       if (clone_flags & CLONE_THREAD)
diff --git a/queue-3.10/tracing-try-again-for-saved-cmdline-if-failed-due-to-locking.patch b/queue-3.10/tracing-try-again-for-saved-cmdline-if-failed-due-to-locking.patch
new file mode 100644 (file)
index 0000000..6b80644
--- /dev/null
@@ -0,0 +1,79 @@
+From 379cfdac37923653c9d4242d10052378b7563005 Mon Sep 17 00:00:00 2001
+From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>
+Date: Fri, 30 May 2014 09:42:39 -0400
+Subject: tracing: Try again for saved cmdline if failed due to locking
+
+From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>
+
+commit 379cfdac37923653c9d4242d10052378b7563005 upstream.
+
+In order to prevent the saved cmdline cache from being filled when
+tracing is not active, the comms are only recorded after a trace event
+is recorded.
+
+The problem is, a comm can fail to be recorded if the trace_cmdline_lock
+is held. That lock is taken via a trylock to allow it to happen from
+any context (including NMI). If the lock fails to be taken, the comm
+is skipped. No big deal, as we will try again later.
+
+But! Because of the code that was added to only record after an event,
+we may not try again later as the recording is made as a oneshot per
+event per CPU.
+
+Only disable the recording of the comm if the comm is actually recorded.
+
+Fixes: 7ffbd48d5cab "tracing: Cache comms only after an event occurred"
+Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ kernel/trace/trace.c |   13 +++++++------
+ 1 file changed, 7 insertions(+), 6 deletions(-)
+
+--- a/kernel/trace/trace.c
++++ b/kernel/trace/trace.c
+@@ -1400,12 +1400,12 @@ static void tracing_stop_tr(struct trace
+ void trace_stop_cmdline_recording(void);
+-static void trace_save_cmdline(struct task_struct *tsk)
++static int trace_save_cmdline(struct task_struct *tsk)
+ {
+       unsigned pid, idx;
+       if (!tsk->pid || unlikely(tsk->pid > PID_MAX_DEFAULT))
+-              return;
++              return 0;
+       /*
+        * It's not the end of the world if we don't get
+@@ -1414,7 +1414,7 @@ static void trace_save_cmdline(struct ta
+        * so if we miss here, then better luck next time.
+        */
+       if (!arch_spin_trylock(&trace_cmdline_lock))
+-              return;
++              return 0;
+       idx = map_pid_to_cmdline[tsk->pid];
+       if (idx == NO_CMDLINE_MAP) {
+@@ -1439,6 +1439,8 @@ static void trace_save_cmdline(struct ta
+       memcpy(&saved_cmdlines[idx], tsk->comm, TASK_COMM_LEN);
+       arch_spin_unlock(&trace_cmdline_lock);
++
++      return 1;
+ }
+ void trace_find_cmdline(int pid, char comm[])
+@@ -1480,9 +1482,8 @@ void tracing_record_cmdline(struct task_
+       if (!__this_cpu_read(trace_cmdline_save))
+               return;
+-      __this_cpu_write(trace_cmdline_save, false);
+-
+-      trace_save_cmdline(tsk);
++      if (trace_save_cmdline(tsk))
++              __this_cpu_write(trace_cmdline_save, false);
+ }
+ void