linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Michael Ellerman <patch-notifications@ellerman.id.au>
To: Michael Ellerman <mpe@ellerman.id.au>, linuxppc-dev@ozlabs.org
Cc: matthew.brown.dev@gmail.com
Subject: Re: powerpc/powernv: Fix missing attr initialisation in opal_export_attrs()
Date: Thu, 27 Apr 2017 20:30:58 +1000 (AEST)	[thread overview]
Message-ID: <3wDCsG6vVCz9sNM@ozlabs.org> (raw)
In-Reply-To: <1493257052-828-1-git-send-email-mpe@ellerman.id.au>

On Thu, 2017-04-27 at 01:37:32 UTC, Michael Ellerman wrote:
> In opal_export_attrs() we dynamically allocate some bin_attributes. They're
> allocated with kmalloc() and although we initialise most of the fields, we don't
> initialise write() or mmap(), and in particular we don't initialise the lockdep
> related fields in the embedded struct attribute.
> 
> This leads to a lockdep warning at boot:
> 
>   BUG: key c0000000f11906d8 not in .data!
>   WARNING: CPU: 0 PID: 1 at ../kernel/locking/lockdep.c:3136 lockdep_init_map+0x28c/0x2a0
>   ...
>   Call Trace:
>     lockdep_init_map+0x288/0x2a0 (unreliable)
>     __kernfs_create_file+0x8c/0x170
>     sysfs_add_file_mode_ns+0xc8/0x240
>     __machine_initcall_powernv_opal_init+0x60c/0x684
>     do_one_initcall+0x60/0x1c0
>     kernel_init_freeable+0x2f4/0x3d4
>     kernel_init+0x24/0x160
>     ret_from_kernel_thread+0x5c/0xb0
> 
> Fix it by kzalloc'ing the attr, which fixes the uninitialised write() and
> mmap(), and calling sysfs_bin_attr_init() on it to initialise the lockdep
> fields.
> 
> Fixes: 11fe909d2362 ("powerpc/powernv: Add OPAL exports attributes to sysfs")
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

Applied to powerpc next.

https://git.kernel.org/powerpc/c/83c4919058459c32138a1ebe35f72b

cheers

      reply	other threads:[~2017-04-27 10:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-27  1:37 [PATCH] powerpc/powernv: Fix missing attr initialisation in opal_export_attrs() Michael Ellerman
2017-04-27 10:30 ` Michael Ellerman [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3wDCsG6vVCz9sNM@ozlabs.org \
    --to=patch-notifications@ellerman.id.au \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=matthew.brown.dev@gmail.com \
    --cc=mpe@ellerman.id.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).