Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3440089imu; Sun, 11 Nov 2018 15:08:37 -0800 (PST) X-Google-Smtp-Source: AJdET5eWE3CF82lh043VzhR6TzliCB8gyTUDr0SXKgndgEzRjRPz2keNBQhRIW05h/tOc3BtCDy5 X-Received: by 2002:a62:4c6:: with SMTP id 189-v6mr13816117pfe.110.1541977716911; Sun, 11 Nov 2018 15:08:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541977716; cv=none; d=google.com; s=arc-20160816; b=H+cPTWWJiVTk2n9OIZnwIQcDkKO+DYc5u9pDL0OS8EViXJtHEJM+J/D2xZmITc9aW3 itZVubZeHogpN0lcW9YYZBEFn1PwTtze5JJIQjTYgv2zTzB5smMCXeizaNE+jbQFbic2 gAI0811V9ddVRGu9IHiYhHzCcpDW7epqd/i9hdNEbPfqLOh9BeG8vt4m9RuA+P+LbovE IVDMpe3IyLmUmYP83RqQ4plzz/YE0mv82F2JrCv+20bLLrQ6ZWXmDuSgIzGcHq+4K4yg JezdJhK9/iyZpN5lVtr0sTcGxfwyiMHwrJXck+9W00u4/2j1GLQLbNwEcdv5JtsCouo+ K/bQ== 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=l18SK5bxzMBXaJIj9XgJ8Hek+COmpzl/Q4pUXCQ+U80=; b=MdDe9OpwY6rHR6Q99gZKBjwwakHPewrN8YgQZDk3OZSSZ3zpcIT2Cl4tGKlnPx/IYh wnxwbjzNMPkDfR/Q87wHdnA9sqKWtHuCu2qEY6kMfUq80+rDHRvq2iBu34/b/OR9YG2O N7582YF/GXclxB8Sk6KUApW2FDFnLAyRJkCODjC3kl8M3zHlkchNgAfH9EJ1mL0Ig6hd m25r+UloC89thCWBY2exoKmCRWspCsnUggQlgdnmTQOVzlYTtdI6FhGeknr0nvBEKJen cS0bXgjDHvzz34/dGgWjtaHhJl8EjIhQCh8IXGQf4rKMHEmjpnDWUM4x7CCEXdh93M1i YqEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ck6rVzRm; 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 m38si14855363pgl.125.2018.11.11.15.08.21; Sun, 11 Nov 2018 15:08:36 -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=ck6rVzRm; 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 S2390271AbeKLIWH (ORCPT + 99 others); Mon, 12 Nov 2018 03:22:07 -0500 Received: from mail.kernel.org ([198.145.29.99]:51168 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390245AbeKLIWE (ORCPT ); Mon, 12 Nov 2018 03:22:04 -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 3CCDE223DD; Sun, 11 Nov 2018 22:32:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975527; bh=sv7DMN2i2QDLgFpP3FVOwUDUsajD/iqZjZXgMVUs5V4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ck6rVzRmGPPfnzDhfyRA3IEDiFLR6p94GQkFTFdaQSUfZKMG5ASbJ18EQ8SwSc8bB 1iKtefrHucfgTSShfOjCcm+pJsdJXmfvMadRxaO/aTGHIFEBmg1Y1uDhoql/p+Kkes zYF1ideY7emCaPHRcEfUo9CUr/yKcOTqUjZyfNPw= 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.14 006/222] jffs2: free jffs2_sb_info through jffs2_kill_sb() Date: Sun, 11 Nov 2018 14:21:43 -0800 Message-Id: <20181111221648.449638344@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221647.665769131@linuxfoundation.org> References: <20181111221647.665769131@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.14-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 */