Received: by 10.192.165.156 with SMTP id m28csp110078imm; Wed, 18 Apr 2018 18:20:28 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/W4CX9GnLMG0xmEfSik4C/GnC/TDfgun9ZjpmaNkb6kCD4a9K9FGxQDF39ENl8tG7BC2A+ X-Received: by 2002:a17:902:a981:: with SMTP id bh1-v6mr4121804plb.255.1524100828897; Wed, 18 Apr 2018 18:20:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524100828; cv=none; d=google.com; s=arc-20160816; b=JFxBZJUheARSovCqf6whzQncPWD2PaP7Qe/HFC6m4PTlWV0SG/cFNGYJuYpuz2AKQB TAyDVTzfGaE79FkFxmdlPky3wSq5KAPfSkA+rwfZI6B7SFD2ggbA5HBGyvXnWzcU0n0n RNLXQX5/7iiao+ZF0y09hHsbiy+yWHJ/sz+eydJTabGq2gFSCkqAzQ87Qs+XcYfJJR/4 E5TO5UC0tp3298Rvo3A2QWr8Uvr5Gk285qpD+9EPpH8L53bF0FfTYeeRtO3E8B8N6eoM jncjNHGgkowU3uePXj6j2MyXrsiGLxv2yggFgdMbvFmqqkBBYZrG1izfTk2rR14fLoxO 3C3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:arc-authentication-results; bh=n3rPKVq26L5mXx9sgcrpELWNevgV/eu/HOrGWBoV/PE=; b=ZiepRGJMRghPb1y4SzZT9tpNrwt7gN44RaqFVGnzSj1+KDtnvUgqE/FM3fhVTy9uBR RsA5Ny8ZDbPzrcY3zneNZgDEGdaqrSL5qSGram2ZnkaXlIDxiWYM+sbGy3Q3pftnMik/ JvnTVlnjwzSy5V35ofZu5VC51E95Wk9Gzqqw2PJz5v4jhUEBN+FCGfywjwkvSBgM+GP1 ogQ3AuB6pKLMCquliGQKrY4AmjzrSaeA4+885d/PG0g/nkzED/eqqdHJUNWXIi5FTb0X zqLDpgu7OUrhTr4FnzgDCUSgBJZzNrqRl8KJUxUuF5KaYqOs1YyOQDJFW1kHJqAodblm 3NKw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e125si2039202pfe.244.2018.04.18.18.20.14; Wed, 18 Apr 2018 18:20:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753065AbeDSBSv convert rfc822-to-8bit (ORCPT + 99 others); Wed, 18 Apr 2018 21:18:51 -0400 Received: from mout.gmx.net ([212.227.17.20]:55341 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752634AbeDSBSt (ORCPT ); Wed, 18 Apr 2018 21:18:49 -0400 Received: from [172.17.46.226] ([122.224.77.194]) by mail.gmx.com (mrgmx101 [212.227.17.174]) with ESMTPSA (Nemesis) id 0LeALI-1ef6Zj3YYG-00pqaV; Thu, 19 Apr 2018 03:18:36 +0200 Content-Type: text/plain; charset=gb2312 Mime-Version: 1.0 (Mac OS X Mail 11.3 \(3445.6.18\)) Subject: Re: [PATCH 1/2] hfs: fix potential refcnt problem of nls module From: "cgxu519@gmx.com" In-Reply-To: <20180418124251.d66a36cb23673f0d8b152910@linux-foundation.org> Date: Thu, 19 Apr 2018 09:18:53 +0800 Cc: "cgxu519@gmx.com" , linux-fsdevel@vger.kernel.org, dhowells@redhat.com, kstewart@linuxfoundation.org, gregkh@linuxfoundation.org, tglx@linutronix.de, pombredanne@nexb.com, linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8BIT Message-Id: <060F1E17-ECD0-41F5-B635-2A0E16967433@gmx.com> References: <1523948733-8537-1-git-send-email-cgxu519@gmx.com> <20180418124251.d66a36cb23673f0d8b152910@linux-foundation.org> To: Andrew Morton X-Mailer: Apple Mail (2.3445.6.18) X-Provags-ID: V03:K1:94Ni1M2+6nulXzCtIP/kFm7fC8a/Q3vVOfeMvKvg3ZycW2RDzYp X7q+lZCAlIOvvhTDXcrSaEza1HirJ/EMghHvYUsj2EMxyZBhUc4Jg3HThKtEdth5220OGDP hrIRZoqeyiknRlEBRAJiEaLN4wFEc2VKOziauj9Rius7lPlhXUZ+UE1XPd2avH8TSuPjCWl K2IV7Ispc8IB07P1Wpfeg== X-UI-Out-Filterresults: notjunk:1;V01:K0:6rRJty5P4TM=:kioWEMOSeU86D0hEcS6vN3 Zrd/ghPAd0Xba40bpJPaHid32zlBVLoY8GqLiYxahfm+lYQ6HxX7pasBAGO4Kcdmu57tw9UcL bVX6RWxHXzqTPwHt56g/ce20XC5zmgP5aniVimJRyj/SQbunZqFTdmJH+LEw5ps2Si7WYTRPK /dQDImrB5y/MTsq8R10ZLl/yogeHZY8TbUmtGJjjoGI04NhOxiyAPI1lfCQP4Xu8GR4rDuX+Y 9+5dQjAOBcIKDmkzNj3b6701PG/DhuT91YIA/kpD5I3ZpLqVsL89DStUjaaVPlQlMwEow2cuz 1FMRmOTaCySLKZSu/2lw9c8SsKhBaum1E3BiAXreU0wUPPM4YHaZr2Qkg4bw8KSRv3dm1TMLV 3aAXYaFdc2yuL9AgRYYGqPn67bLoD2dXVy3m2OzBPyBrhp8pAxdYrrfiRulZL3GozE4a68ZNj 3KMYX5MhxHgkp6omv1HqkENJef9azHB/3uREo0akg4XDbc8zwPLgHNlzSl0gl1m8HbyZgx/Re CKiz8cQiVv81Naa2ltB/SBbUdiGD2PwynMCwQvlnmN02ZqX2Cf/Lynn22UmHWXAirI9w71fF+ mZdKnCpjipx5ziCpRcX46UkaBtJ7ti1joy5HpZKsij6xnLE6/G2wEkP09DOblyaAkJNf9kQwg GPtiLYhKTZRHVlXvLX/3QXj19weniNJcWqck+DhDnwPXWdmPji9eQu5mfSPPZrMl7RxZEbMKq NGmzKNpfGDC6TkAeBqTLpCZUJj9CL2+OGdfdIIvRUWrB2PZ8l0rxx8dMmGEbYOFeo7q5whvVe UMFIkLpcLiW0298gdlNvMFByc53t02q3aGW5NCDpyQktX5nagA= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ?? 2018??4??19?գ?????3:42??Andrew Morton д???? > > On Tue, 17 Apr 2018 15:05:32 +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. >> >> ... >> >> --- 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); > > Confused. > > break; > : case opt_codepage: > : if (hsb->nls_disk) { > : pr_err("unable to change codepage\n"); > : return 0; > : } > > Here, hsb->nls_disk is known to be zero. > > : p = match_strdup(&args[0]); > : if (p) { > : unload_nls(hsb->nls_disk); > > So this will always do unload_nls(0). > > : hsb->nls_disk = load_nls(p); > : } > > And the same applies to your opt_iocharset change. You are right. Sorry I just misread this part, please just drop the patch. Thanks.