Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp4808267imm; Mon, 15 Oct 2018 23:42:23 -0700 (PDT) X-Google-Smtp-Source: ACcGV6233Ho0it+lrnt+SHl4vv0/UQuAXH6Y4Gdb0gy1GwbokkCKlsxmNtPLQnoo8A1ZfWDIDXc7 X-Received: by 2002:a62:6414:: with SMTP id y20-v6mr20860740pfb.213.1539672143341; Mon, 15 Oct 2018 23:42:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539672143; cv=none; d=google.com; s=arc-20160816; b=XndsSQ3aDWbdB6pTNfY/FL9ol8IhCLtFN5qdKwUQinJGXWfE+mf/+1XgkYPQy0fjkm ZHBF435Aj0Mr0z5Xf3q1U86yHKlkPAgO/0imWH274T9nTjB/DEMrvzKqCueYYmJESFpB OzzY9wU8UnJqsHGPNbWkt1fAN0zuu0LXNdVSW2m+8zQc/Uo+zzx1RnwbH1kgsPORdGVZ r4X+/J8WnFVgAj3oLklletxOBczThtWdbbUSF89bJv6z33SSbgYO1GifToR3E3YtFxK4 n6UuggI8IgcsPLdqZ2GjPukyKaKITO4E1ngduiDfPjpZrMaaiVvrL7N76iBWNBIcWc1+ l+DQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=vya5/59rJPCibuVnexig501tmX1ODUQtYAJNIzOjyJ0=; b=s76Fqv0U1DRZ81fX87zY7Mrwzn5IGs/EzI1abNgfw67R228mUkD8OCRorPCoOkwfFl Hov0MYxx3JmxcJfIXAxyif+NpdBaLICxwtYrew3vMze90DwhL0MoRc8fdjYN5uq+RFjj GeE9zgz8pKEfaaN9UnrcUITaBO5mrh8yzN7G6oRFfqD+OoC1MN0X7fxdlZA/kTA7QybS JvM/EUGRsWHI2sazlaoztIE2/oS6MHMMU2Md793H4TV+kpszGj91SXKply7bYHtExjFQ rV4LdQ4JfA5XR/xJVYnZiuMIZZ/OHnRo+APRIPan9WvjaBw6Hxc1JG4tW6qckH8XmqUg LgcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=N2avWeIS; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j13-v6si12537249pfn.288.2018.10.15.23.42.07; Mon, 15 Oct 2018 23:42:23 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=N2avWeIS; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727447AbeJPOaL (ORCPT + 99 others); Tue, 16 Oct 2018 10:30:11 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:33743 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727094AbeJPOaK (ORCPT ); Tue, 16 Oct 2018 10:30:10 -0400 Received: by mail-wr1-f68.google.com with SMTP id e4-v6so24031802wrs.0 for ; Mon, 15 Oct 2018 23:41:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=vya5/59rJPCibuVnexig501tmX1ODUQtYAJNIzOjyJ0=; b=N2avWeISQ9j6h6IkjExu0onmm21vvFRRGqhGv1c1AaE68UE1VqOSZ6sBV49VORmwgl 7pMeu6SJ3W1MJhcR9Ur79TfzywkpIdjynxcuRoYgtjn0tCECKXZYR2Z+LWW8r6ew8fB1 o5UBKqmhj7UnO1nief01/TyM1dDYDhH9IdPW5+l9a38NvaFWM72SXr1JfqSBlF92CN91 S+PvWTybYOLM5itiYOWFtGMA6ZKix9/Fu+r1CKXPOOm7rD70ce54qAS3gwIs9PoxTj24 JgQeOgSOvQ/TqKR/usUqLz27ZCi9f30HFozky7VOwA3nOxY4jw/NW+fr2gN2s3VXsQj3 NG+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=vya5/59rJPCibuVnexig501tmX1ODUQtYAJNIzOjyJ0=; b=JhBgoXHTq7mmF9Isj9PqFOD8ClXIowTn+PVTMvoc6A6G4CVFlZ8v3P6B57afenbbYB guX+lpRy+yu+0Zd+LRFTjiFxqt+2W8nM0j/XhMu6F1QG6OkszoTFu1X1RvceQVqJJJDw Oh/kimnHhpZvZQfwnEeSbd7B0mVnemo15MNPLifSqhjjfJqsiGePsP4iA3+0loRmmJA7 HBExpqZfwisfeXqxCW1/mFaEwuVddJmM+DdF44lGysIyi5APTjHCb05Gw36Yw9rYcwVs bLSUm+bOqMOWJb15v2zb9gKBEaswnnhmrumQsTFmzjZTB/kukAl7hEm/WduTmCPJjoWx b6Ug== X-Gm-Message-State: ABuFfoiQpMnlIfj/7m+/3AxHXNMQ1UMiEAA1MmeYRzHOL/WOZPlgIEue RLOrmY7cL2AjUJ3EHqF6+KatX+ejElwNuoDSGjk= X-Received: by 2002:adf:dd83:: with SMTP id x3-v6mr16944122wrl.212.1539672073945; Mon, 15 Oct 2018 23:41:13 -0700 (PDT) MIME-Version: 1.0 References: <20181006090935.41714-1-houtao1@huawei.com> <6401cb90-a1fe-afd5-c302-ddae40876736@huawei.com> In-Reply-To: <6401cb90-a1fe-afd5-c302-ddae40876736@huawei.com> From: Richard Weinberger Date: Tue, 16 Oct 2018 08:41:02 +0200 Message-ID: Subject: Re: [PATCH] jffs2: free jffs2_sb_info through jffs2_kill_sb() To: houtao1@huawei.com Cc: "linux-mtd @ lists . infradead . org" , LKML , David Woodhouse , stable@kernel.org, Arnd Bergmann , Al Viro , Brian Norris Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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, //richard