From: greg <gregkh@linuxfoundation.org>
To: yan <clouds.yan@gmail.com>
Cc: kernel <linux-kernel@vger.kernel.org>, message <message.get@gmail.com>
Subject: Re: [PATCH 3/4][Trivial] lib/kobject.c : Check ktype in kobject_add_internal
Date: Mon, 23 Apr 2012 13:40:48 -0700 [thread overview]
Message-ID: <20120423204048.GC13075@kroah.com> (raw)
In-Reply-To: <1335002414.2188.27.camel@yan>
On Sat, Apr 21, 2012 at 05:58:31PM +0800, yan wrote:
> If someone calls kobject_init with null kobj_type, kobject_init can
> detect it. But it does not have a return value, it just dumps stack.
> In this case, a kobject_add after that will result in:
> -->kobject_add_varg
> -->kobject_add_internal
> -->create_dir
> -->sysfs_create_dir
> -->sysfs_read_ns_type
> -->kobj_child_ns_ops
> In the end, it will call ->ktype->child_ns_type directly and we have
> an oops.
>
> Check ktype before really add a kobject.
But how can we add a kobject without a valid ktype?
At the most, I'd prefer to warn about this, much like we warn about not
having a name, and not just returning an error without a hint as to what
went wrong.
greg k-h
prev parent reply other threads:[~2012-04-23 20:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-21 9:58 [PATCH 3/4][Trivial] lib/kobject.c : Check ktype in kobject_add_internal yan
2012-04-23 20:40 ` greg [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=20120423204048.GC13075@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=clouds.yan@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=message.get@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.