linux/drivers/hwtracing/coresight
Sudeep Holla b839215372 coresight: access conn->child_name only if it's initialised
If the addition of the coresight devices get deferred, then there's a
window before child_name is populated by of_get_coresight_platform_data
from the respective component driver's probe and the attempted to access
the same from coresight_orphan_match resulting in kernel NULL pointer
dereference as below:

Unable to handle kernel NULL pointer dereference at virtual address 0x0
Internal error: Oops: 96000004 [#1] PREEMPT SMP
Modules linked in:
CPU: 0 PID: 1038 Comm: kworker/0:1 Not tainted 4.7.0-rc3 #124
Hardware name: ARM Juno development board (r2) (DT)
Workqueue: events amba_deferred_retry_func
PC is at strcmp+0x1c/0x160
LR is at coresight_orphan_match+0x7c/0xd0
Call trace:
 strcmp+0x1c/0x160
 bus_for_each_dev+0x60/0xa0
 coresight_register+0x264/0x2e0
 tmc_probe+0x130/0x310
 amba_probe+0xd4/0x1c8
 driver_probe_device+0x22c/0x418
 __device_attach_driver+0xbc/0x158
 bus_for_each_drv+0x58/0x98
 __device_attach+0xc4/0x160
 device_initial_probe+0x10/0x18
 bus_probe_device+0x94/0xa0
 device_add+0x344/0x580
 amba_device_try_add+0x194/0x238
 amba_deferred_retry_func+0x48/0xd0
 process_one_work+0x118/0x378
 worker_thread+0x48/0x498
 kthread+0xd0/0xe8
 ret_from_fork+0x10/0x40

This patch adds a check for non-NULL conn->child_name before accessing
the same.

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-31 13:05:42 +02: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 hwtracing/coresight-etm3x: Convert to hotplug state machine 2016-07-15 10:40:29 +02:00
coresight-etm4x-sysfs.c coresight: moving coresight_simple_func() to header file 2016-05-01 14:12:14 -07:00
coresight-etm4x.c hwtracing/coresight-etm4x: Convert to hotplug state machine 2016-07-15 10:40:30 +02: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: access conn->child_name only if it's initialised 2016-08-31 13:05:42 +02: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