Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp5068734imm; Tue, 16 Oct 2018 04:50:24 -0700 (PDT) X-Google-Smtp-Source: ACcGV62mZKtjw8ZsypgZZa0j1QAKyHImiBGr7G+xbVCF8wbumagx//Y7yELbF9Xp9mtY0pH2SDzh X-Received: by 2002:a63:510a:: with SMTP id f10-v6mr19725496pgb.31.1539690624904; Tue, 16 Oct 2018 04:50:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539690624; cv=none; d=google.com; s=arc-20160816; b=mJQkZeuJS8xN3kzi9aH4C/RCEYF+AzCfTaTXjLkNYA0d5aulTK9z5t2ZhWlMUtFSUa 7ax3C86w98ibqgspql78eHn8w2T/3vN46Hf2LkjECk4vnBj4YbWPEE0BvHazGUH4Bi1I BNOymQCKsjrCjAcrHdV3HvsTzHIHwdLdCkISFh+PcQ0GkGvBALh2aupPMtdd20OW04Xm YpZkvGfxt0LHlsQVdclkibLqCRCXSCs7CmOy+6y43tDZDGDENkzyrOOIBM6CqK0TpFHk 7IhQXi+Q7IfC6bFmpA2XwvpQQaD2E5mozLYjL/fKM3HEKO2mIjlCVs03qJaesaMiF8SI XcLg== 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:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=JHzXbdrGUkv0E9AGMioUbms4flckCdBUlvclpvNtE7w=; b=P9c2nj8oIz9GFHJD+kJuFVNU/nP73ENvpUjjsy9n8t9EgeIh1inrs6YiYcMLTAeyfM EVi3qHM0FZHsc5FkHf3fFMO/+LqIugGj4iI5DXqD1mGnA7IyoUmPrD5Tng8DWmFLAsJi P5ZVBxk2p4Hx+WTkEVkA8ItyzRQqTk/da2wUDDNEVIegPv6nX7wEFFl2cHVgbvsLgncD j44ozw0OG0USb5eQHjAOAqEf+IGqT+hS7uAni6OtnTGThW9nTrg+kugUuCcSZ15/ymcv lxSoED5/CimBHqDhX7+7aEcqr/engBHnkJIQG5qXTMWrGGU47gc+gtaZqS8R1toMbD7m yHCA== 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 o9-v6si13917628pfe.283.2018.10.16.04.50.08; Tue, 16 Oct 2018 04:50:24 -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 S1727097AbeJPTjv (ORCPT + 99 others); Tue, 16 Oct 2018 15:39:51 -0400 Received: from mail.bootlin.com ([62.4.15.54]:44008 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726760AbeJPTjv (ORCPT ); Tue, 16 Oct 2018 15:39:51 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id C67A0207BF; Tue, 16 Oct 2018 13:49:42 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from bbrezillon (AAubervilliers-681-1-7-245.w90-88.abo.wanadoo.fr [90.88.129.245]) by mail.bootlin.com (Postfix) with ESMTPSA id 75982206A1; Tue, 16 Oct 2018 13:49:32 +0200 (CEST) Date: Tue, 16 Oct 2018 13:49:33 +0200 From: Boris Brezillon To: Hou Tao Cc: Richard Weinberger , Arnd Bergmann , LKML , "linux-mtd @ lists . infradead . org" , Al Viro , Brian Norris , David Woodhouse , stable@kernel.org Subject: Re: [PATCH] jffs2: free jffs2_sb_info through jffs2_kill_sb() Message-ID: <20181016134933.0504707f@bbrezillon> In-Reply-To: <9bb38d45-41c7-9f16-bf6b-d21ba6617f1c@huawei.com> References: <20181006090935.41714-1-houtao1@huawei.com> <6401cb90-a1fe-afd5-c302-ddae40876736@huawei.com> <9bb38d45-41c7-9f16-bf6b-d21ba6617f1c@huawei.com> X-Mailer: Claws Mail 3.15.0-dirty (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 16 Oct 2018 18:26:34 +0800 Hou Tao wrote: > 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. Applied after adding Fixes: 92abc475d8de ("jffs2: implement mount option parsing and compression overriding") > > Regards, > Tao > > > ______________________________________________________ > Linux MTD discussion mailing list > http://lists.infradead.org/mailman/listinfo/linux-mtd/