linux/drivers/hwtracing/coresight
Suzuki K Poulose f3b8172fe1 coresight: Fix erroneous memset in tmc_read_unprepare_etr
At the end of a trace collection, we try to clear the entire buffer
and enable the ETR back if it was already enabled. But, we would have
adjusted the drvdata->buf to point to the beginning of the trace data
in the trace buffer @drvdata->vaddr. So, the following code which
clears the buffer is dangerous and can cause crashes, like below :

	memset(drvdata->buf, 0, drvdata->size);

 Unable to handle kernel paging request at virtual address ffffff800a145000
 pgd = ffffffc974726000
 *pgd=00000009f3e91003, *pud=00000009f3e91003, *pmd=0000000000000000
 PREEMPT SMP
 Modules linked in:
 CPU: 4 PID: 1692 Comm: dd Not tainted 4.7.0-rc2+ #1721
 Hardware name: ARM Juno development board (r0) (DT)
 task: ffffffc9734a0080 ti: ffffffc974460000 task.ti: ffffffc974460000
 PC is at __memset+0x1ac/0x200
 LR is at tmc_read_unprepare_etr+0x144/0x1bc
 pc : [<ffffff80083a05ac>] lr : [<ffffff800859c984>] pstate: 200001c5
 ...
 [<ffffff80083a05ac>] __memset+0x1ac/0x200
 [<ffffff800859b2e4>] tmc_release+0x90/0x94
 [<ffffff8008202f58>] __fput+0xa8/0x1ec
 [<ffffff80082030f4>] ____fput+0xc/0x14
 [<ffffff80080c3ef8>] task_work_run+0xb0/0xe4
 [<ffffff8008088bf4>] do_notify_resume+0x64/0x6c
 [<ffffff8008084d5c>] work_pending+0x10/0x14
 Code: 91010108 54ffff4a 8b040108 cb050042 (d50b7428)

Since we clear the buffer anyway in the following call to
tmc_etr_enable_hw(), remove the erroneous memset().

Fixes: commit de5461970b ("coresight: tmc: allocating memory when needed")
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-16 00:13:06 -07:00
..
coresight-etb10.c coresight: etb10: adjust read pointer only when needed 2016-05-03 14:59:30 -07:00
coresight-etm3x-sysfs.c coresight: moving coresight_simple_func() to header file 2016-05-01 14:12:14 -07:00
coresight-etm3x.c drivers/hwtracing: make coresight-* explicitly non-modular 2016-02-20 14:11:01 -08:00
coresight-etm4x-sysfs.c coresight: moving coresight_simple_func() to header file 2016-05-01 14:12:14 -07:00
coresight-etm4x.c coresight: etm4x: add tracer ID for A72 Maia processor. 2016-05-03 14:59:30 -07:00
coresight-etm4x.h coresight: etm4x: modify q_support type 2016-05-03 14:59:30 -07:00
coresight-etm-cp14.c
coresight-etm-perf.c drivers/hwtracing: make coresight-etm-perf.c explicitly non-modular 2016-03-05 12:19:39 -08:00
coresight-etm-perf.h coresight: etm-perf: new PMU driver for ETM tracers 2016-02-20 14:11:01 -08:00
coresight-etm.h coresight: etm3x: implementing user/kernel mode tracing 2016-02-20 14:11:01 -08:00
coresight-funnel.c coresight: removing gratuitous boot time log messages 2016-05-01 14:12:14 -07:00
coresight-priv.h coresight: moving struct cs_buffers to header file 2016-05-03 14:59:30 -07:00
coresight-replicator-qcom.c drivers/hwtracing: make coresight-* explicitly non-modular 2016-02-20 14:11:01 -08:00
coresight-replicator.c coresight: removing gratuitous boot time log messages 2016-05-01 14:12:14 -07:00
coresight-stm.c coresight: stm: adding driver for CoreSight STM component 2016-05-03 14:59:30 -07:00
coresight-tmc-etf.c coresight: tmc: implementing TMC-ETF AUX space API 2016-05-03 14:59:30 -07:00
coresight-tmc-etr.c coresight: Fix erroneous memset in tmc_read_unprepare_etr 2016-06-16 00:13:06 -07:00
coresight-tmc.c coresight: tmc: keep track of memory width 2016-05-03 14:59:30 -07:00
coresight-tmc.h coresight: tmc: implementing TMC-ETF AUX space API 2016-05-03 14:59:30 -07:00
coresight-tpiu.c coresight: removing gratuitous boot time log messages 2016-05-01 14:12:14 -07:00
coresight.c coresight: Fix NULL pointer dereference in _coresight_build_path 2016-06-16 00:13:06 -07:00
Kconfig coresight: stm: adding driver for CoreSight STM component 2016-05-03 14:59:30 -07:00
Makefile coresight: tmc: splitting driver in ETB/ETF and ETR components 2016-05-03 14:59:30 -07:00
of_coresight.c drivers/hwtracing: make coresight-* explicitly non-modular 2016-02-20 14:11:01 -08:00