Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp2828595ybg; Thu, 24 Oct 2019 16:09:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqz6iJfZA9bThRXQH+S5h4C35A0ndAdtWYjfpuvUO1xv/wAidlpjpE6sfxE3lUT1DgVB5lyC X-Received: by 2002:a05:6402:28e:: with SMTP id l14mr766853edv.70.1571958564005; Thu, 24 Oct 2019 16:09:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571958563; cv=none; d=google.com; s=arc-20160816; b=mTGULgdW+MGfht8qTM19+2HwGw0HgStmrN+PBXOBC6NJqK3fuoo4tLH4e8O40F/Mqo BVXmfLmmQd7dkeAZ4EI3ZSKOxN7yskJkB9iSyzlByB5wjR/+lv9EA3hJNlfs3sEpTVuk sxO5G2cubzVwYzNLr9MPUnyNTzWku5Ya5wfPu8gmCAbHVIhf6hP1EspsQ51EnesKGtYy sj3dvUsVMHzlwgctR7hEUeigb1Ru5282KO0GsAHqWunWAn7e+x8LV4ae9QtXEyMeC/dp YL3atWECN3rqjKUN+0HxClTH4C7TGARI4+fKftI6oUe3mCO++QAdypDyz9X67miMXuYG Q47A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=dGs5rRvLHduO+VWP3CRRC1kxaYwFrvC0eIX4OrY4Sdg=; b=exzO50srKwPnSlRqvmZdjQLq7pjq/Z+xISvlOVFzEQVqw9HewYWQc1OcgGTY9PUBvK Duu36xsd0Jg1tu2EIvnG6JhhREw82BvTmtOTWXuzlTeDl4BMB+YIVBVCHUwRSDmxkm1r 8Asfm/m69KHv7AtoL4fJg6OAIA2D7a2dEEZ9pg+WjHzTRSHIGiMbvnzWcgj+nkV9N4Yl VwIxmsLGS53UxPpGGIxGojDGSRyQuDHk2ZxSn2BFvPSwKSQJBd5WXJ7/lXYAzgbMH9sH tzSabDojRgWgxt1+bwdn9op5XdeydRWj7h/ometgodyBYHAPxNJuOfJJ5IK7yO57pr9/ /mRg== 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 n3si26945edc.151.2019.10.24.16.09.00; Thu, 24 Oct 2019 16:09: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; 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 S2438169AbfJXIZ7 (ORCPT + 99 others); Thu, 24 Oct 2019 04:25:59 -0400 Received: from lilium.sigma-star.at ([109.75.188.150]:32868 "EHLO lilium.sigma-star.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725947AbfJXIZ7 (ORCPT ); Thu, 24 Oct 2019 04:25:59 -0400 Received: from localhost (localhost [127.0.0.1]) by lilium.sigma-star.at (Postfix) with ESMTP id B0B9A18108D3A; Thu, 24 Oct 2019 10:25:56 +0200 (CEST) Received: from lilium.sigma-star.at ([127.0.0.1]) by localhost (lilium.sigma-star.at [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 6mNXa_C_RHjG; Thu, 24 Oct 2019 10:25:55 +0200 (CEST) Received: from lilium.sigma-star.at ([127.0.0.1]) by localhost (lilium.sigma-star.at [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 4GDjBp6oxDFB; Thu, 24 Oct 2019 10:25:55 +0200 (CEST) From: Richard Weinberger To: linux-mtd@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Richard Weinberger , Wenwen Wang Subject: [PATCH] Revert "ubifs: Fix memory leak bug in alloc_ubifs_info() error path" Date: Thu, 24 Oct 2019 10:25:35 +0200 Message-Id: <20191024082535.1022-1-richard@nod.at> X-Mailer: git-send-email 2.16.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This reverts commit 9163e0184bd7d5f779934d34581843f699ad2ffd. At the point when ubifs_fill_super() runs, we have already a reference to the super block. So upon deactivate_locked_super() c will get free()'ed via ->kill_sb(). Cc: Wenwen Wang Fixes: 9163e0184bd7 ("ubifs: Fix memory leak bug in alloc_ubifs_info() error path") Reported-by: https://twitter.com/grsecurity/status/1180609139359277056 Signed-off-by: Richard Weinberger --- fs/ubifs/super.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index 7d4547e5202d..5e1e8ec0589e 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c @@ -2267,10 +2267,8 @@ static struct dentry *ubifs_mount(struct file_system_type *fs_type, int flags, } } else { err = ubifs_fill_super(sb, data, flags & SB_SILENT ? 1 : 0); - if (err) { - kfree(c); + if (err) goto out_deact; - } /* We do not support atime */ sb->s_flags |= SB_ACTIVE; if (IS_ENABLED(CONFIG_UBIFS_ATIME_SUPPORT)) -- 2.16.4