Re: [PATCH] module: return error when mod_sysfs_init() failed

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Greg KH <gregkh@...>
Cc: <linux-kernel@...>, Rusty Russell <rusty@...>
Date: Saturday, September 29, 2007 - 11:37 am

2007/9/29, Greg KH <gregkh@suse.de>:

Hello,

In the original code, the "err" is zero before goto cleanup.
This "err" will be the return value of load_module().

load_module() is the function which returns error as pointer
and the expression IS_ERR(NULL) is false. So the caller of load_module()
cannot catch that error.

I found this problem when I was running the fault injection test
script in Documentation/fault-injection/fault-injection.txt with
random module.

#!/bin/bash

FAILTYPE=failslab
echo Y > /debug/$FAILTYPE/task-filter
echo 10 > /debug/$FAILTYPE/probability
echo 100 > /debug/$FAILTYPE/interval
echo -1 > /debug/$FAILTYPE/times
echo 0 > /debug/$FAILTYPE/space
echo 2 > /debug/$FAILTYPE/verbose
echo 0 > /debug/$FAILTYPE/ignore-gfp-wait

faulty_system()
{
        bash -c "echo 1 > /proc/self/make-it-fail && exec $*"
}

if [ $# -eq 0 ]
then
        echo "Usage: $0 modulename [ modulename ... ]"
        exit 1
fi

for m in $*
do
        echo inserting $m...
        faulty_system modprobe $m

        echo removing $m...
        faulty_system modprobe -r $m
done
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH] module: return error when mod_sysfs_init() failed, Akinobu Mita, (Sat Sep 29, 11:37 am)