From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Chengguang Xu To: linux-fsdevel@vger.kernel.org Cc: dhowells@redhat.com, kstewart@linuxfoundation.org, gregkh@linuxfoundation.org, tglx@linutronix.de, pombredanne@nexb.com, linux-kernel@vger.kernel.org, Chengguang Xu Subject: [PATCH 2/2] hfsplus: fix potential refcnt problem of nls module Date: Tue, 17 Apr 2018 15:05:33 +0800 Message-Id: <1523948733-8537-2-git-send-email-cgxu519@gmx.com> In-Reply-To: <1523948733-8537-1-git-send-email-cgxu519@gmx.com> References: <1523948733-8537-1-git-send-email-cgxu519@gmx.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: When specifying nls option multiple times in a mount, current option parsing will cause inaccurate refcount of nls module. Hence, call unload_nls for previous one in this case. Signed-off-by: Chengguang Xu --- fs/hfsplus/options.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/hfsplus/options.c b/fs/hfsplus/options.c index 047e05c..068d4e2 100644 --- a/fs/hfsplus/options.c +++ b/fs/hfsplus/options.c @@ -171,8 +171,10 @@ int hfsplus_parse_options(char *input, struct hfsplus_sb_info *sbi) return 0; } p = match_strdup(&args[0]); - if (p) + if (p) { + unload_nls(sbi->nls); sbi->nls = load_nls(p); + } if (!sbi->nls) { pr_err("unable to load nls mapping \"%s\"\n", p); -- 1.8.3.1