diff options
author | Dmitry Eremin <dmitry.eremin@intel.com> | 2017-01-28 19:05:01 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-02-03 07:01:37 -0500 |
commit | c2351249f140aebdf911d86d7a1542c40b20fca3 (patch) | |
tree | d1bcf0f9cf958a3942dbfa5d135f97c3c2f19fe7 | |
parent | aabb4adaddb39431ae68c126bd8d2d09e69dd3e0 (diff) |
staging: lustre: libcfs: avoid stomping on module param cpu_pattern
The function cfs_cpt_table_create_pattern() alters the string
passed to it. Currently we are passing in the module parameter
string cpu_pattern which is incorrect. Instead lets duplicate
the module parameter string and pass that to the function
cfs_cpt_table_create_pattern().
Signed-off-by: Liang Zhen <liang.zhen@intel.com>
Signed-off-by: Dmitry Eremin <dmitry.eremin@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5050
Reviewed-on: http://review.whamcloud.com/22377
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Olaf Weber <olaf@sgi.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c b/drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c index 427e2198bb9e..71a5b190ea5a 100644 --- a/drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c +++ b/drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c | |||
@@ -1050,7 +1050,15 @@ cfs_cpu_init(void) | |||
1050 | ret = -EINVAL; | 1050 | ret = -EINVAL; |
1051 | 1051 | ||
1052 | if (*cpu_pattern) { | 1052 | if (*cpu_pattern) { |
1053 | cfs_cpt_table = cfs_cpt_table_create_pattern(cpu_pattern); | 1053 | char *cpu_pattern_dup = kstrdup(cpu_pattern, GFP_KERNEL); |
1054 | |||
1055 | if (!cpu_pattern_dup) { | ||
1056 | CERROR("Failed to duplicate cpu_pattern\n"); | ||
1057 | goto failed; | ||
1058 | } | ||
1059 | |||
1060 | cfs_cpt_table = cfs_cpt_table_create_pattern(cpu_pattern_dup); | ||
1061 | kfree(cpu_pattern_dup); | ||
1054 | if (!cfs_cpt_table) { | 1062 | if (!cfs_cpt_table) { |
1055 | CERROR("Failed to create cptab from pattern %s\n", | 1063 | CERROR("Failed to create cptab from pattern %s\n", |
1056 | cpu_pattern); | 1064 | cpu_pattern); |