summaryrefslogtreecommitdiff
path: root/samples
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@google.com>2017-11-08 10:38:18 +0100
committerGreg Kroah-Hartman <gregkh@google.com>2017-11-08 10:38:18 +0100
commit46d256da87ef1132f02d234b885110d96c6889eb (patch)
tree8ba3e2a720ac1e9d05d4bfbcefce81e5a48a1732 /samples
parentfaa82dcc9d4dc3cc362d28832216df54de963e6e (diff)
parentc54d0707aa09a824413ebb4195c98bfb9b9e1fc0 (diff)
Merge 4.4.97 into android-4.4
Changes in 4.4.97 ALSA: timer: Add missing mutex lock for compat ioctls ALSA: seq: Fix nested rwsem annotation for lockdep splat cifs: check MaxPathNameComponentLength != 0 before using it KEYS: return full count in keyring_read() if buffer is too small KEYS: fix out-of-bounds read during ASN.1 parsing ASoC: adau17x1: Workaround for noise bug in ADC arm64: ensure __dump_instr() checks addr_limit ARM: dts: mvebu: pl310-cache disable double-linefill ARM: 8715/1: add a private asm/unaligned.h ocfs2: fstrim: Fix start offset of first cluster group during fstrim perf tools: Fix build failure on perl script context drm/msm: Fix potential buffer overflow issue drm/msm: fix an integer overflow test tracing/samples: Fix creation and deletion of simple_thread_fn creation Fix tracing sample code warning. PM / wakeirq: report a wakeup_event on dedicated wekup irq mmc: s3cmci: include linux/interrupt.h for tasklet_struct ARM: pxa: Don't rely on public mmc header to include leds.h mfd: ab8500-sysctrl: Handle probe deferral mfd: axp20x: Fix axp288 PEK_DBR and PEK_DBF irqs being swapped staging: rtl8712u: Fix endian settings for structs describing network packets ext4: fix stripe-unaligned allocations ext4: do not use stripe_width if it is not set i2c: riic: correctly finish transfers drm/amdgpu: when dpm disabled, also need to stop/start vce. perf tools: Only increase index if perf_evsel__new_idx() succeeds cx231xx: Fix I2C on Internal Master 3 Bus xen/manage: correct return value check on xenbus_scanf() scsi: aacraid: Process Error for response I/O platform/x86: intel_mid_thermal: Fix module autoload staging: lustre: llite: don't invoke direct_IO for the EOF case staging: lustre: hsm: stack overrun in hai_dump_data_field staging: lustre: ptlrpc: skip lock if export failed exynos4-is: fimc-is: Unmap region obtained by of_iomap() mei: return error on notification request to a disconnected client s390/dasd: check for device error pointer within state change interrupts bt8xx: fix memory leak xen: don't print error message in case of missing Xenstore entry staging: r8712u: Fix Sparse warning in rtl871x_xmit.c Linux 4.4.97 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'samples')
-rw-r--r--samples/trace_events/trace-events-sample.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/samples/trace_events/trace-events-sample.c b/samples/trace_events/trace-events-sample.c
index 880a7d1d27d2..4ccff66523c9 100644
--- a/samples/trace_events/trace-events-sample.c
+++ b/samples/trace_events/trace-events-sample.c
@@ -78,28 +78,36 @@ static int simple_thread_fn(void *arg)
}
static DEFINE_MUTEX(thread_mutex);
+static int simple_thread_cnt;
void foo_bar_reg(void)
{
+ mutex_lock(&thread_mutex);
+ if (simple_thread_cnt++)
+ goto out;
+
pr_info("Starting thread for foo_bar_fn\n");
/*
* We shouldn't be able to start a trace when the module is
* unloading (there's other locks to prevent that). But
* for consistency sake, we still take the thread_mutex.
*/
- mutex_lock(&thread_mutex);
simple_tsk_fn = kthread_run(simple_thread_fn, NULL, "event-sample-fn");
+ out:
mutex_unlock(&thread_mutex);
}
void foo_bar_unreg(void)
{
- pr_info("Killing thread for foo_bar_fn\n");
- /* protect against module unloading */
mutex_lock(&thread_mutex);
+ if (--simple_thread_cnt)
+ goto out;
+
+ pr_info("Killing thread for foo_bar_fn\n");
if (simple_tsk_fn)
kthread_stop(simple_tsk_fn);
simple_tsk_fn = NULL;
+ out:
mutex_unlock(&thread_mutex);
}