From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f196.google.com ([209.85.192.196]:46415 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752077AbeDRRK6 (ORCPT ); Wed, 18 Apr 2018 13:10:58 -0400 Received: by mail-pf0-f196.google.com with SMTP id h69so1216828pfe.13 for ; Wed, 18 Apr 2018 10:10:58 -0700 (PDT) Message-ID: <1524071456.2606.7.camel@dubeyko.com> Subject: Re: [PATCH 1/2] hfs: fix potential refcnt problem of nls module From: Viacheslav Dubeyko To: Chengguang Xu , 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, Andrew Morton Date: Wed, 18 Apr 2018 10:10:56 -0700 In-Reply-To: <1523948733-8537-1-git-send-email-cgxu519@gmx.com> References: <1523948733-8537-1-git-send-email-cgxu519@gmx.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Tue, 2018-04-17 at 15:05 +0800, Chengguang Xu wrote: > When specifying iocharset/codepage 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 Looks good. Reviewed-by: Vyacheslav Dubeyko Thanks, Vyacheslav Dubeyko. > --- >  fs/hfs/super.c | 8 ++++++-- >  1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/fs/hfs/super.c b/fs/hfs/super.c > index 1738767..6a5f6fd 100644 > --- a/fs/hfs/super.c > +++ b/fs/hfs/super.c > @@ -329,8 +329,10 @@ static int parse_options(char *options, struct > hfs_sb_info *hsb) >   return 0; >   } >   p = match_strdup(&args[0]); > - if (p) > + if (p) { > + unload_nls(hsb->nls_disk); >   hsb->nls_disk = load_nls(p); > + } >   if (!hsb->nls_disk) { >   pr_err("unable to load codepage > \"%s\"\n", p); >   kfree(p); > @@ -344,8 +346,10 @@ static int parse_options(char *options, struct > hfs_sb_info *hsb) >   return 0; >   } >   p = match_strdup(&args[0]); > - if (p) > + if (p) { > + unload_nls(hsb->nls_io); >   hsb->nls_io = load_nls(p); > + } >   if (!hsb->nls_io) { >   pr_err("unable to load iocharset > \"%s\"\n", p); >   kfree(p);