[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20120423204048.GC13075@kroah.com>
Date: Mon, 23 Apr 2012 13:40:48 -0700
From: greg <gregkh@...uxfoundation.org>
To: yan <clouds.yan@...il.com>
Cc: kernel <linux-kernel@...r.kernel.org>,
message <message.get@...il.com>
Subject: Re: [PATCH 3/4][Trivial] lib/kobject.c : Check ktype in
kobject_add_internal
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists