From: Andrew Morton Date: Tue, 7 Feb 2006 20:58:45 +0000 (-0800) Subject: [PATCH] module: strlen_user() race fix X-Git-Tag: firefly_0821_release~38185 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=8e08b756869eeb08ace17ad64c2a8cb97b18e856;p=firefly-linux-kernel-4.4.55.git [PATCH] module: strlen_user() race fix Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/kernel/module.c b/kernel/module.c index e058aedf6b93..5aad477ddc79 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -1670,6 +1670,9 @@ static struct module *load_module(void __user *umod, goto free_mod; } + /* Userspace could have altered the string after the strlen_user() */ + args[arglen - 1] = '\0'; + if (find_module(mod->name)) { err = -EEXIST; goto free_mod;