lkml.org 
[lkml]   [2013]   [Mar]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/3] lib/kobject: Panic when kobj or ktype is not properly assigned
On Tue, Mar 19, 2013 at 02:47:00PM +0800, Dong Hao wrote:
> From: Dong Hao <haodong@linux.vnet.ibm.com>
>
> kobj and ktype are two important attributes which will be used after kobject_init(),
> and (!kobj)|(!ktype) may cause FS corruption which could not be recovered.
> Panic instead of dump_stack() when neither kobj nor ktype is properly assigned to
> detect the bug early.
>
> Signed-off-by: Dong Hao <haodong@linux.vnet.ibm.com>
> ---
> lib/kobject.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/kobject.c b/lib/kobject.c
> index 279a172..ff9b3c3 100644
> --- a/lib/kobject.c
> +++ b/lib/kobject.c
> @@ -290,7 +290,7 @@ void kobject_init(struct kobject *kobj, struct kobj_type *ktype)
>
> error:
> printk(KERN_ERR "kobject (%p): %s\n", kobj, err_str);
> - dump_stack();
> + BUG_ON(1);

You just crashed the machine. That's horrible, and unacceptable.

*plonk*


\
 
 \ /
  Last update: 2013-03-19 15:01    [W:0.085 / U:0.152 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site