Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp4987942imm; Tue, 16 Oct 2018 03:28:08 -0700 (PDT) X-Google-Smtp-Source: ACcGV62vyyn1T3037FmNA/fvlOLYa7fc3FDtihUOXE5CD2K7FCK9XGbXI0L49ZLohtL9N1aP7oOH X-Received: by 2002:a17:902:6903:: with SMTP id j3-v6mr17186342plk.74.1539685688910; Tue, 16 Oct 2018 03:28:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539685688; cv=none; d=google.com; s=arc-20160816; b=M4PkZcZtgZIdEk3G74vZTcf+ZkEwuiNEsIDnfp46aSnI8D2nG7fOrW8rifdGaT4kqA AIYIV2XAhYgwYX6FrFo4D/Jjth+sHvnZR7FH+KF/4UmmY91D/mgdwkccZqva9aFMlkpi XGnba4U3J0tToZ3bZ48WFk5zH1xmv+6MidVu3hpDgwHAKb10zpLHyxAYaSaMy6hydqv+ MU5wFQCSJLg5tPFgfcbadWzuwSg0KN7jgH5/jyVxRax3l8WjJAXyMOwBamFCSdvqMdwF gmU/DeQZsEVpmT6gEMcaspN2K8n47Qv+aW/pwqqf4h01hus0es1SV6ANbnC2EO9T+svp yWQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=V3Q3QMk/mCzIHws5UlnBD0ID6nb7JjMFRmNKT7s9u2M=; b=RiOgid9+SEbXn5LC6bFZjmx2CbgtX4/qI5xaCNdGWBSKl7rnJJTIPOmNrBsD41Tdh+ Mgi/3xLG5VGGL5Im0/2OvNoTQg6KmcygnzUqj3fjeaTSaW2nDXfzRg3bQYizVVFmPxwZ +hY3Ny6gbIDSchOG+Y33XN7j0NogV3foMNjjJLlE9RJxAN1s9HKH/ATFzxBwa/JkoY6s nX7+G19FZmvH6bsfy7itpd3GfgQq5c0PJCozwuasJV0YK6Rgxpdat6TqA9wUssCidxkm lYItFY+gkt/iM/12ONZpmRXqvEp9YFcaFFXoZBY2I8c3JVQFLC+ue6h+RGVjDK6DYU6i anog== 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 u38-v6si13003333pgn.106.2018.10.16.03.27.51; Tue, 16 Oct 2018 03:28:08 -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 S1727035AbeJPSQ1 (ORCPT + 99 others); Tue, 16 Oct 2018 14:16:27 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:41692 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726165AbeJPSQ1 (ORCPT ); Tue, 16 Oct 2018 14:16:27 -0400 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 0233EFF506AF1; Tue, 16 Oct 2018 18:26:39 +0800 (CST) Received: from [127.0.0.1] (10.177.31.14) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.399.0; Tue, 16 Oct 2018 18:26:35 +0800 Subject: Re: [PATCH] jffs2: free jffs2_sb_info through jffs2_kill_sb() To: Richard Weinberger CC: "linux-mtd @ lists . infradead . org" , LKML , David Woodhouse , , Arnd Bergmann , Al Viro , Brian Norris References: <20181006090935.41714-1-houtao1@huawei.com> <6401cb90-a1fe-afd5-c302-ddae40876736@huawei.com> From: Hou Tao Message-ID: <9bb38d45-41c7-9f16-bf6b-d21ba6617f1c@huawei.com> Date: Tue, 16 Oct 2018 18:26:34 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.31.14] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018/10/16 14:41, Richard Weinberger wrote: > On Tue, Oct 16, 2018 at 7:53 AM Hou Tao wrote: >> >> ping ? >> >> On 2018/10/6 17:09, Hou Tao wrote: >>> When an invalid mount option is passed to jffs2, jffs2_parse_options() >>> will fail and jffs2_sb_info will be freed, but then jffs2_sb_info will >>> be used (use-after-free) and freeed (double-free) in jffs2_kill_sb(). >>> >>> Fix it by removing the buggy invocation of kfree() when getting invalid >>> mount options. >>> >>> Cc: stable@kernel.org >>> Signed-off-by: Hou Tao >>> --- >>> fs/jffs2/super.c | 4 +--- >>> 1 file changed, 1 insertion(+), 3 deletions(-) >>> >>> diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c >>> index 87bdf0f4cba1..902a7dd10e5c 100644 >>> --- a/fs/jffs2/super.c >>> +++ b/fs/jffs2/super.c >>> @@ -285,10 +285,8 @@ static int jffs2_fill_super(struct super_block *sb, void *data, int silent) >>> sb->s_fs_info = c; >>> >>> ret = jffs2_parse_options(c, data); >>> - if (ret) { >>> - kfree(c); >>> + if (ret) >>> return -EINVAL; >>> - } > > Reviewed-by: Richard Weinberger > > We can carry this via the MTD tree. Thanks for that. Regards, Tao