summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Fu <fxinrong@gmail.com>2017-09-11 02:33:21 +0200
committerThomas Gleixner <tglx@linutronix.de>2017-09-25 09:36:16 +0200
commit7d7099433d9eaaa5a989a55f1fa354c16a3ad297 (patch)
tree256e2478d50bb3f68bae7892f763c2843d7d69d3
parentx86/mm: Fix fault error path using unsafe vma pointer (diff)
downloadlinux-7d7099433d9eaaa5a989a55f1fa354c16a3ad297.tar.xz
linux-7d7099433d9eaaa5a989a55f1fa354c16a3ad297.zip
x86/sysfs: Fix off-by-one error in loop termination
An off-by-one error in loop terminantion conditions in create_setup_data_nodes() will lead to memory leak when create_setup_data_node() failed. Signed-off-by: Sean Fu <fxinrong@gmail.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/1505090001-1157-1-git-send-email-fxinrong@gmail.com
-rw-r--r--arch/x86/kernel/ksysfs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/x86/kernel/ksysfs.c b/arch/x86/kernel/ksysfs.c
index 4b0592ca9e47..8c1cc08f514f 100644
--- a/arch/x86/kernel/ksysfs.c
+++ b/arch/x86/kernel/ksysfs.c
@@ -299,7 +299,7 @@ static int __init create_setup_data_nodes(struct kobject *parent)
return 0;
out_clean_nodes:
- for (j = i - 1; j > 0; j--)
+ for (j = i - 1; j >= 0; j--)
cleanup_setup_data_node(*(kobjp + j));
kfree(kobjp);
out_setup_data_kobj: