Received: by 10.192.165.156 with SMTP id m28csp1517007imm; Tue, 17 Apr 2018 00:07:46 -0700 (PDT) X-Google-Smtp-Source: AIpwx48tDCZuNvzbKcYOFi1oRPJbHvm0I4R965M7pu5lZ1brP3KdNQAqq7fcCwnZbc8pfkdNUflD X-Received: by 10.101.72.201 with SMTP id o9mr439632pgs.390.1523948866809; Tue, 17 Apr 2018 00:07:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523948866; cv=none; d=google.com; s=arc-20160816; b=b8MzTFgqiKL9FW1l1PsAi4k4AABQMga3yWRBkI89Y1TRSGaGVFxyjeCTglc0UAraX9 zRvAsjkjtGzan1O73i+e2+R0mWomoHTeFajG6xQALHSyjUXBRUQ82R+dMlTlQNYoEoRC bXHWETebB0X1edXXuHdHtkhdCiE1x/Ednxem7LLRMVnlTOXSDshZarVfwtHVWl72+DQG P+iZ7E7KKFN7IlKL2zTe3EUnz8vVzDWWM763qwIECM+Mgm32f9vjMaOUCSyMoWgGLa55 iqodfdqcja746EJc6qmN8WUhGEfW00UeBjPTT5ibsa+gwpCaSFtruohk0fPAkOPG6zLc 2FlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=mh2ambuFYPmcQwIG7PF0N/3xYvXpJXTxXc/EWuvWiEc=; b=eZczqGg3kV9/VJEqetYbR6IFDnPOSgoN9vUUQlY7cSijSLe+lyjtGBP/AxmVbc5GrQ kYoR2DNK2a+K3VOouCVICEOLHPgpPn8JOAKc8YIpmO7+fj0FUKcfGt1Ww0P3NpKoQ+mC NxRzF738r4CwzPraa8yhzXPYG2TA6IKIPGJPh4tRXcif5fUICup6+wYmj6Y5VGzSVCxi B4xshFxEgTEfjnHrlgWKPRTzeK1iSQNSJRa9pHdrCqyyvo4gwGA7namQsi7hzSfINJ9r iVfWE69QZlrrTQNMJsJjuEFFjQToQTlVI+hakdNMufnL6WTynPw8hL5YKLpSTS5TYnZX N0yA== 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 h4-v6si12850093pls.502.2018.04.17.00.07.31; Tue, 17 Apr 2018 00:07:46 -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 S1751267AbeDQHGO (ORCPT + 99 others); Tue, 17 Apr 2018 03:06:14 -0400 Received: from mout.gmx.net ([212.227.15.18]:60365 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751183AbeDQHGN (ORCPT ); Tue, 17 Apr 2018 03:06:13 -0400 Received: from localhost.localdomain ([122.225.81.134]) by mail.gmx.com (mrgmx002 [212.227.17.184]) with ESMTPSA (Nemesis) id 0LkOaJ-1ebSyi3QPj-00cSdn; Tue, 17 Apr 2018 09:06:00 +0200 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 1/2] hfs: fix potential refcnt problem of nls module Date: Tue, 17 Apr 2018 15:05:32 +0800 Message-Id: <1523948733-8537-1-git-send-email-cgxu519@gmx.com> X-Mailer: git-send-email 1.8.3.1 X-Provags-ID: V03:K1:CszVP9qSHiabmQSPp3S+gVMkrDlcQ+163q4l5dvsX0bpmwqAtpb 274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owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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); -- 1.8.3.1