From 552a813a22e92e2964fc9cc3c47b768185d54bdc Mon Sep 17 00:00:00 2001 From: Alex Zhuravlev Date: Mon, 25 Mar 2024 10:39:51 +0300 Subject: [PATCH 1/1] LU-17673 llite: ll_options() to release the string the final strsep() sets opts to NULL so kfree() becomes no-op. Signed-off-by: Alex Zhuravlev Change-Id: I18a0d3556fa2932c217d9e705af9e5b5720a364b Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/54554 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin Reviewed-by: James Simmons Reviewed-by: Andreas Dilger --- lustre/llite/llite_lib.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index ff0cd9f..c8ee45a 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -1071,7 +1071,7 @@ int ll_sbi_flags_seq_show(struct seq_file *m, void *v) static int ll_options(char *options, struct super_block *sb) { struct ll_sb_info *sbi = ll_s2sbi(sb); - char *s2, *s1, *opts; + char *s2, *s1, *opts, *orig_opts; int err = 0; ENTRY; @@ -1079,7 +1079,7 @@ static int ll_options(char *options, struct super_block *sb) RETURN(0); /* Don't stomp on lmd_opts */ - opts = kstrdup(options, GFP_KERNEL); + orig_opts = opts = kstrdup(options, GFP_KERNEL); if (!opts) RETURN(-ENOMEM); s1 = opts; @@ -1244,7 +1244,7 @@ static int ll_options(char *options, struct super_block *sb) break; } } - kfree(opts); + kfree(orig_opts); RETURN(err); } -- 1.8.3.1