Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3493644imu; Sun, 11 Nov 2018 16:21:22 -0800 (PST) X-Google-Smtp-Source: AJdET5crJpqxeiqE6K/ndySjxs9Uv+yNwYLY11HRZQwZ0iWCYZpxp7PpR9rRE3jzw0Dj15erGAWy X-Received: by 2002:a17:902:3a5:: with SMTP id d34-v6mr17876748pld.110.1541982082113; Sun, 11 Nov 2018 16:21:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541982082; cv=none; d=google.com; s=arc-20160816; b=a+pY6rqoBsh1TAAYtiLG6Nf5WzGLahTz2q6Eublglr4Xe75WsvK7itHUntV+x4unNt eOaJWmeMDke/at/3rb1keaES0guRowUlOxqRkqtbrIDR0015Cqnx/uIdsmrOZKoNkiNY CHI3fA+hPAN9CpOECuk3HgzXgI+y6Z0DEAtzS6bdwARaf9bS1IMQgD9tS3/Vy5zOlxO5 vVUf/UapyKg1Hz4T4sSqx/AoQ4KLeIMNnOtknukFVW0vQwtsoWfcSUFp4u6vh1Vcb3Dp /1Jbo10CC23pm5oku1hyVvLJfDmA12xKqHtksZYLUXvOH94UOPe6SxgGoAlhrWihPBpf fIYw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QuZHPnINu4u1dpzh1t56MHHVcj/qKBiDpeeDmkajn3M=; b=ihNQ3nYgrrm4OWdhJ1cZKnAzwgU65Qr462TrArdqN2stFPRWWj9wl69ItOe7xct5YT 5zEx6Pd+Hf1tMdgGVxkZyhENmHzMFJp5e7WGw6PubZ2hbJmG8AjTpoghbAQymzoRVsJn zIkEVt9kASr/b0GDwc415NNdoexKowQ1Rq5H+C3Is43T+e0rSU2Se733Kym34VqNhm/R GaNvG5uYjYRHcvBmbejjq3gQ/zUwBNd72tv2i1ET+jzHoCoQf7vrgB5+Rvqp8TGxVejy GK2MrS+8QujdV4lP885OkNNjHnWy/WTHK5uDYzhLurRSeYSI8dmhAO7IAbxzniprywh7 YnDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="FHot/xTW"; 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 b35-v6si16017057plh.326.2018.11.11.16.21.07; Sun, 11 Nov 2018 16:21:22 -0800 (PST) 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=@kernel.org header.s=default header.b="FHot/xTW"; 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 S1729870AbeKLIQy (ORCPT + 99 others); Mon, 12 Nov 2018 03:16:54 -0500 Received: from mail.kernel.org ([198.145.29.99]:58446 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726816AbeKLIQx (ORCPT ); Mon, 12 Nov 2018 03:16:53 -0500 Received: from localhost (unknown [206.108.79.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D5370216FD; Sun, 11 Nov 2018 22:26:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975217; bh=89N7itqN3eeg1ox3ffVrvLyO8vJA8jQC4S0KYRkCqwQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FHot/xTW191lhEloryxnHhEfX9bKnIxgU8IVJgCRheh37St8FS4fGAaATUMMLxvHS K5CLg9lsKhWbq8ePuLx2DZ37xth7mnORWxRfTWfAGTrFr94buSxo6anr3huLXX3wzy 3NCkHPxo3P5uKqksoPvM+IKZC4mGACncp/cuDrgc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Hou Tao , Richard Weinberger , Boris Brezillon Subject: [PATCH 4.19 017/361] jffs2: free jffs2_sb_info through jffs2_kill_sb() Date: Sun, 11 Nov 2018 14:16:04 -0800 Message-Id: <20181111221622.204526777@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221619.915519183@linuxfoundation.org> References: <20181111221619.915519183@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Hou Tao commit 92e2921f7eee63450a5f953f4b15dc6210219430 upstream. 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. Fixes: 92abc475d8de ("jffs2: implement mount option parsing and compression overriding") Cc: stable@kernel.org Signed-off-by: Hou Tao Reviewed-by: Richard Weinberger Signed-off-by: Boris Brezillon Signed-off-by: Greg Kroah-Hartman --- fs/jffs2/super.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) --- a/fs/jffs2/super.c +++ b/fs/jffs2/super.c @@ -285,10 +285,8 @@ static int jffs2_fill_super(struct super sb->s_fs_info = c; ret = jffs2_parse_options(c, data); - if (ret) { - kfree(c); + if (ret) return -EINVAL; - } /* Initialize JFFS2 superblock locks, the further initialization will * be done later */