Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1098578imm; Mon, 21 May 2018 21:26:47 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqfPSQcXHnYvL3L5oS60gzxKKE8Vl1dVMt/TK8ILLEjMYrMzlLBDUI8vyzyzVzmBjBN3Cf0 X-Received: by 2002:a17:902:8303:: with SMTP id bd3-v6mr22794393plb.290.1526963207452; Mon, 21 May 2018 21:26:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526963207; cv=none; d=google.com; s=arc-20160816; b=oDD5vS/AnA8W6HxrsRh7zZ0ZxPbKkR/3uyGEyF/8iPV/PC1FOaabBjd6tM8Ux/fzxK gfzlGhYDJEwPhnDC3+ndsyepUIpSAAvJD/FPOGCK61vSJnUKlUxcNh6hf9qCO6B55yRt fEXSSiXUOyH31lCQ/WyKmE32E7oMZ4LyrZsDGew0XHW/LPaWHBGpJzM3Jrf+5NePrvrL y8sY6Ss2cdmGijq5d55yaYzGP9fYR1WcmvJRLq8gr/AomT5sSa9ecQ+W481ELYfVlDbR O108geAnk6dTDZ7cwWXrFy82cbTyeNsEQkUicZqVa3sX71WBeEGNVRe989hHPKSgVj/1 UrRg== 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=fdyj6C9dMu1zon6LvAMxkAdBOYdWOOTSRDCnxbSAvnc=; b=0FUKSuvJ6T+wJ/ZIx1ZzPTR4pwJyn+h7viXXsaZWyhxfdM45lUXGSUX+Zk895dcIuf 9wGWzxK1R/kyH/Obvx9HJ8VdIMPg/VkoWRgSbdKt5SyiIL98x62dcf9T6CJrzMytlP5Y Gf3tvpkujpUCHp1TFLYw7K97lkUyz+4z2Lppsm+4kfxy9Q26vKPqp9CTUlyrQz+sH7Zk EuWNE/tdt0i5bJ+k9cr3DRVUpLi+2ROMNqiMiQGHcmlWgOEcQAKaO8tIVWYg2oJJWbSB eq6v2m2M0/idruuwOp4KfoA7BVDJmpV9yiq4i+oyxmnR7sBSIpjuuropnKK96M4SdC3I Z/6w== 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 bc7-v6si15479656plb.310.2018.05.21.21.26.32; Mon, 21 May 2018 21:26:47 -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 S1751261AbeEVEZH (ORCPT + 99 others); Tue, 22 May 2018 00:25:07 -0400 Received: from mout.gmx.net ([212.227.17.20]:51017 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750707AbeEVEZG (ORCPT ); Tue, 22 May 2018 00:25:06 -0400 Received: from juanniu018037.ss.mogujie.org ([122.225.81.134]) by mail.gmx.com (mrgmx101 [212.227.17.174]) with ESMTPSA (Nemesis) id 0MIzGn-1fMtbA28fB-002XPb; Tue, 22 May 2018 06:24:54 +0200 From: Chengguang Xu To: linux-fsdevel@vger.kernel.org Cc: dsterba@suse.com, dhowells@redhat.com, jlayton@redhat.com, viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org, Chengguang Xu Subject: [PATCH] fs/affs: fix potential memory leak in option parsing Date: Tue, 22 May 2018 12:24:25 +0800 Message-Id: <1526963065-21134-1-git-send-email-cgxu519@gmx.com> X-Mailer: git-send-email 1.8.3.1 X-Provags-ID: V03:K1:NYtj1vKjUjRHqVWL/ibx/z3Fs3xQ3UMPAfdvATUUhMILJ/cszpW 9F0USEbR+3E46I1ln5eGYIIas2paapj0b7Mc1KDBxrMv6ooNLp/4yQ6EnIgUfKIFcgUWnhV 7WoaW59QI1bEq2QiRmPSkejfCsxuBSQx7r3GQQe8hIkO69RiSV7ic8NnA22l4IWEGlKtYnp +jGDW6Ge1yJAeEDY9ooaA== X-UI-Out-Filterresults: notjunk:1;V01:K0:PTq92YDhiz8=:QgxHL5b8DVHK0Pf0OgzIqW pufYyHB/qilb2g2F1Mk8s44uXbqaZmL2GUTKQbrb7dcLoAAGaTzjmOhKyfnxKB/45A5qSZbU4 OXTWZHEZA7OA2uNiqB/m9QPYF7A445kzUCLtNm63YMv9AG8LDy9FVwjGlmUwy2ih/YsR5U6t/ lWJdVv8qIQ4UvbmJAL+2Co6Ax8KNBy4PVXV9zuLUs3HvMDvV9GiRkxW3ItZOCf170HMUUJnlJ t9kcV3nrH+y7VrNNf53qfsUwtpV+QjIVaROC0bMd06j8m0dqtnhFfqQiz5QZccVobuyB5YcTZ 0dmyCluS+8MTT73wnqVlfIHF8dskfyIquwMpBGNLE/hbI1PCzNTiyBK38rZ2zCN3dlE+G7l5C 5zBhAUPDJiYWKWPlcrUGy/l2/NzKw76ZXp8nQ4ByXwCWzErUXdLadzzAP1c9thVc9StFExxgG uXNTuK4z/F444EJMiKU9pcqdiMrZnpRjaBkZb7SR3hWUnlKTYZXZObDpbJdHf2wuVlDm95r3L j3vcue5Jvf7A9vT0jQcjdxjavG32D75S+q5tSXuENHm6mDSZkXnWor7oz5gfYyrDDTRjZZA18 niTM9mNazNyu0xNnnqHSCHGhdxQCCxQy5KB1H65jPXNlw76/7E6f6+OmHKEVGjFLuy+AA/ZA0 OItYEVze3K42stCq8RZh2eEbTRubORmTqQ+fKtktYf69TNIzkB9soLxsUcvMmfCg9JskYWowd D/XqGAlYPc//we3UcrPTg6uoF39E2TMbwsUdhoea20f1PD97MGDQQqlXorA= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When specifying option 'prefix' multiple times, current option parsing will cause memory leak. Hence, call kfree for previous one in this case. Signed-off-by: Chengguang Xu --- fs/affs/super.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/affs/super.c b/fs/affs/super.c index e602619..d1ad11a 100644 --- a/fs/affs/super.c +++ b/fs/affs/super.c @@ -241,6 +241,7 @@ enum { affs_set_opt(*mount_opts, SF_NO_TRUNCATE); break; case Opt_prefix: + kfree(*prefix); *prefix = match_strdup(&args[0]); if (!*prefix) return 0; -- 1.8.3.1