fail_function: fix wrong use of fei_attr_remove()
If register_kprobe() fails, the new attr is not added to the list yet, so
it should call fei_attr_free() intstead.
Link: https://lkml.kernel.org/r/20220826073337.2085798-3-yangyingliang@huawei.com
Fixes: 4b1a29a7f5 ("error-injection: Support fault injection framework")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
cef9f5f866
commit
d2e85432a2
1 changed files with 1 additions and 1 deletions
|
|
@ -295,7 +295,7 @@ static ssize_t fei_write(struct file *file, const char __user *buffer,
|
||||||
|
|
||||||
ret = register_kprobe(&attr->kp);
|
ret = register_kprobe(&attr->kp);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
fei_attr_remove(attr);
|
fei_attr_free(attr);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
fei_debugfs_add_attr(attr);
|
fei_debugfs_add_attr(attr);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue