public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [LKP] [params] RIP: 0010:[<ffffffff811c1a04>] [<ffffffff811c1a04>] sysfs_add_file_mode_ns+0x64/0x1f0
       [not found] <1421030743.6201.154.camel@intel.com>
@ 2015-01-13  3:08 ` Rusty Russell
  0 siblings, 0 replies; only message in thread
From: Rusty Russell @ 2015-01-13  3:08 UTC (permalink / raw)
  To: Huang Ying; +Cc: LKML, LKP ML, Eric W. Biederman

Huang Ying <ying.huang@intel.com> writes:
> FYI, we noticed the below changes on
>
> commit 18eb74fa94161380c1acc9cf562cb835c4e54a25 ("params: cleanup sysfs allocation")

Thanks!

This is caused by CONFIG_DEBUG_LOCK_ALLOC, which adds fields to
'struct attribute'.  In particular ignore_lockdep is never initialized.

If we memset to 0 before calling sysfs_attr_init() (which doesn't
actually initialize the attribute!), this is fixed.

Cheers,
Rusty.

Subject: param: fix uninitialized read with CONFIG_DEBUG_LOCK_ALLOC

ignore_lockdep is uninitialized, and sysfs_attr_init() doesn't initialize
it, so memset to 0.

Reported-by: Huang Ying <ying.huang@intel.com>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

diff --git a/kernel/params.c b/kernel/params.c
index bd65d136a470..728e05b167de 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -642,6 +642,7 @@ static __modinit int add_sysfs_param(struct module_kobject *mk,
 	mk->mp->grp.attrs = new_attrs;
 
 	/* Tack new one on the end. */
+	memset(&mk->mp->attrs[mk->mp->num], 0, sizeof(mk->mp->attrs[0]));
 	sysfs_attr_init(&mk->mp->attrs[mk->mp->num].mattr.attr);
 	mk->mp->attrs[mk->mp->num].param = kp;
 	mk->mp->attrs[mk->mp->num].mattr.show = param_attr_show;

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-01-13  3:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1421030743.6201.154.camel@intel.com>
2015-01-13  3:08 ` [LKP] [params] RIP: 0010:[<ffffffff811c1a04>] [<ffffffff811c1a04>] sysfs_add_file_mode_ns+0x64/0x1f0 Rusty Russell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox