stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] coresight: Fix DEBUG_LOCKS_WARN_ON for uninitialized attribute
@ 2019-08-12 13:53 Suzuki K Poulose
  2019-08-13 18:37 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Suzuki K Poulose @ 2019-08-12 13:53 UTC (permalink / raw)
  To: stable; +Cc: suzuki.poulose, mathieu.poirier, linux-arm-kernel, gregkh

commit 5511c0c309db4c526a6e9f8b2b8a1483771574bc upstream

While running the linux-next with CONFIG_DEBUG_LOCKS_ALLOC enabled,
I get the following splat.

 BUG: key ffffcb5636929298 has not been registered!
 ------------[ cut here ]------------
 DEBUG_LOCKS_WARN_ON(1)
 WARNING: CPU: 1 PID: 53 at kernel/locking/lockdep.c:3669 lockdep_init_map+0x164/0x1f0
 CPU: 1 PID: 53 Comm: kworker/1:1 Tainted: G  W  5.2.0-next-20190712-00015-g00ad4634222e-dirty #603
 Workqueue: events amba_deferred_retry_func
 pstate: 60c00005 (nZCv daif +PAN +UAO)
 pc : lockdep_init_map+0x164/0x1f0
 lr : lockdep_init_map+0x164/0x1f0

 [ trimmed ]

 Call trace:
  lockdep_init_map+0x164/0x1f0
  __kernfs_create_file+0x9c/0x158
  sysfs_add_file_mode_ns+0xa8/0x1d0
  sysfs_add_file_to_group+0x88/0xd8
  etm_perf_add_symlink_sink+0xcc/0x138
  coresight_register+0x110/0x280
  tmc_probe+0x160/0x420

 [ trimmed ]

 ---[ end trace ab4cc669615ba1b0 ]---

Fix this by initialising the dynamically allocated attribute properly.

Fixes: bb8e370bdc14 ("coresight: perf: Add "sinks" group to PMU directory")
Cc: stable@vger.kernel.org # 5.2.x-
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---
 drivers/hwtracing/coresight/coresight-etm-perf.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwtracing/coresight/coresight-etm-perf.c
index 3c6294432748..1ef098ff27c3 100644
--- a/drivers/hwtracing/coresight/coresight-etm-perf.c
+++ b/drivers/hwtracing/coresight/coresight-etm-perf.c
@@ -544,6 +544,7 @@ int etm_perf_add_symlink_sink(struct coresight_device *csdev)
 	/* See function coresight_get_sink_by_id() to know where this is used */
 	hash = hashlen_hash(hashlen_string(NULL, name));
 
+	sysfs_attr_init(&ea->attr.attr);
 	ea->attr.attr.name = devm_kstrdup(pdev, name, GFP_KERNEL);
 	if (!ea->attr.attr.name)
 		return -ENOMEM;
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] coresight: Fix DEBUG_LOCKS_WARN_ON for uninitialized attribute
  2019-08-12 13:53 [PATCH] coresight: Fix DEBUG_LOCKS_WARN_ON for uninitialized attribute Suzuki K Poulose
@ 2019-08-13 18:37 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2019-08-13 18:37 UTC (permalink / raw)
  To: Suzuki K Poulose; +Cc: stable, mathieu.poirier, linux-arm-kernel

On Mon, Aug 12, 2019 at 02:53:28PM +0100, Suzuki K Poulose wrote:
> commit 5511c0c309db4c526a6e9f8b2b8a1483771574bc upstream
> 
> While running the linux-next with CONFIG_DEBUG_LOCKS_ALLOC enabled,
> I get the following splat.
> 

Thanks for the backport, now queued up.

greg k-h

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-08-13 18:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-12 13:53 [PATCH] coresight: Fix DEBUG_LOCKS_WARN_ON for uninitialized attribute Suzuki K Poulose
2019-08-13 18:37 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).