diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/Kconfig.debug | 18 | ||||
| -rw-r--r-- | lib/fault-inject.c | 32 | ||||
| -rw-r--r-- | lib/kobject_uevent.c | 44 | ||||
| -rw-r--r-- | lib/kref.c | 7 | 
4 files changed, 32 insertions, 69 deletions
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 818e4589f71..5c2681875b9 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -354,24 +354,6 @@ config FRAME_POINTER  	  some architectures or if you use external debuggers.  	  If you don't debug the kernel, you can say N. -config UNWIND_INFO -	bool "Compile the kernel with frame unwind information" -	depends on !IA64 && !PARISC && !ARM -	depends on !MODULES || !(MIPS || PPC || SUPERH || V850) -	help -	  If you say Y here the resulting kernel image will be slightly larger -	  but not slower, and it will give very useful debugging information. -	  If you don't debug the kernel, you can say N, but we may not be able -	  to solve problems without frame unwind information or frame pointers. - -config STACK_UNWIND -	bool "Stack unwind support" -	depends on UNWIND_INFO -	depends on X86 -	help -	  This enables more precise stack traces, omitting all unrelated -	  occurrences of pointers into kernel code from the dump. -  config FORCED_INLINING  	bool "Force gcc to inline functions marked 'inline'"  	depends on DEBUG_KERNEL diff --git a/lib/fault-inject.c b/lib/fault-inject.c index d143c0faf24..b5a90fc056d 100644 --- a/lib/fault-inject.c +++ b/lib/fault-inject.c @@ -55,37 +55,7 @@ static bool fail_task(struct fault_attr *attr, struct task_struct *task)  #define MAX_STACK_TRACE_DEPTH 32 -#ifdef CONFIG_STACK_UNWIND - -static asmlinkage int fail_stacktrace_callback(struct unwind_frame_info *info, -						void *arg) -{ -	int depth; -	struct fault_attr *attr = arg; -	bool found = (attr->require_start == 0 && attr->require_end == ULONG_MAX); - -	for (depth = 0; depth < attr->stacktrace_depth -			&& unwind(info) == 0 && UNW_PC(info); depth++) { -		if (arch_unw_user_mode(info)) -			break; -		if (attr->reject_start <= UNW_PC(info) && -			       UNW_PC(info) < attr->reject_end) -			return false; -		if (attr->require_start <= UNW_PC(info) && -			       UNW_PC(info) < attr->require_end) -			found = true; -	} -	return found; -} - -static bool fail_stacktrace(struct fault_attr *attr) -{ -	struct unwind_frame_info info; - -	return unwind_init_running(&info, fail_stacktrace_callback, attr); -} - -#elif defined(CONFIG_STACKTRACE) +#if defined(CONFIG_STACKTRACE)  static bool fail_stacktrace(struct fault_attr *attr)  { diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c index a1922765ff3..84272ed77f0 100644 --- a/lib/kobject_uevent.c +++ b/lib/kobject_uevent.c @@ -63,8 +63,11 @@ static char *action_to_string(enum kobject_action action)   * @action: action that is happening (usually KOBJ_MOVE)   * @kobj: struct kobject that the action is happening to   * @envp_ext: pointer to environmental data + * + * Returns 0 if kobject_uevent() is completed with success or the + * corresponding error when it fails.   */ -void kobject_uevent_env(struct kobject *kobj, enum kobject_action action, +int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,  			char *envp_ext[])  {  	char **envp; @@ -79,14 +82,16 @@ void kobject_uevent_env(struct kobject *kobj, enum kobject_action action,  	u64 seq;  	char *seq_buff;  	int i = 0; -	int retval; +	int retval = 0;  	int j;  	pr_debug("%s\n", __FUNCTION__);  	action_string = action_to_string(action); -	if (!action_string) -		return; +	if (!action_string) { +		pr_debug("kobject attempted to send uevent without action_string!\n"); +		return -EINVAL; +	}  	/* search the kset we belong to */  	top_kobj = kobj; @@ -95,31 +100,39 @@ void kobject_uevent_env(struct kobject *kobj, enum kobject_action action,  			top_kobj = top_kobj->parent;  		} while (!top_kobj->kset && top_kobj->parent);  	} -	if (!top_kobj->kset) -		return; +	if (!top_kobj->kset) { +		pr_debug("kobject attempted to send uevent without kset!\n"); +		return -EINVAL; +	}  	kset = top_kobj->kset;  	uevent_ops = kset->uevent_ops;  	/*  skip the event, if the filter returns zero. */  	if (uevent_ops && uevent_ops->filter) -		if (!uevent_ops->filter(kset, kobj)) -			return; +		if (!uevent_ops->filter(kset, kobj)) { +			pr_debug("kobject filter function caused the event to drop!\n"); +			return 0; +		}  	/* environment index */  	envp = kzalloc(NUM_ENVP * sizeof (char *), GFP_KERNEL);  	if (!envp) -		return; +		return -ENOMEM;  	/* environment values */  	buffer = kmalloc(BUFFER_SIZE, GFP_KERNEL); -	if (!buffer) +	if (!buffer) { +		retval = -ENOMEM;  		goto exit; +	}  	/* complete object path */  	devpath = kobject_get_path(kobj, GFP_KERNEL); -	if (!devpath) +	if (!devpath) { +		retval = -ENOENT;  		goto exit; +	}  	/* originating subsystem */  	if (uevent_ops && uevent_ops->name) @@ -204,7 +217,7 @@ exit:  	kfree(devpath);  	kfree(buffer);  	kfree(envp); -	return; +	return retval;  }  EXPORT_SYMBOL_GPL(kobject_uevent_env); @@ -214,10 +227,13 @@ EXPORT_SYMBOL_GPL(kobject_uevent_env);   *   * @action: action that is happening (usually KOBJ_ADD and KOBJ_REMOVE)   * @kobj: struct kobject that the action is happening to + * + * Returns 0 if kobject_uevent() is completed with success or the + * corresponding error when it fails.   */ -void kobject_uevent(struct kobject *kobj, enum kobject_action action) +int kobject_uevent(struct kobject *kobj, enum kobject_action action)  { -	kobject_uevent_env(kobj, action, NULL); +	return kobject_uevent_env(kobj, action, NULL);  }  EXPORT_SYMBOL_GPL(kobject_uevent); diff --git a/lib/kref.c b/lib/kref.c index 4a467faf136..0d07cc31c81 100644 --- a/lib/kref.c +++ b/lib/kref.c @@ -52,12 +52,7 @@ int kref_put(struct kref *kref, void (*release)(struct kref *kref))  	WARN_ON(release == NULL);  	WARN_ON(release == (void (*)(struct kref *))kfree); -	/* -	 * if current count is one, we are the last user and can release object -	 * right now, avoiding an atomic operation on 'refcount' -	 */ -	if ((atomic_read(&kref->refcount) == 1) || -	    (atomic_dec_and_test(&kref->refcount))) { +	if (atomic_dec_and_test(&kref->refcount)) {  		release(kref);  		return 1;  	}  | 
