From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56A33C2BB55 for ; Thu, 16 Apr 2020 15:47:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 21A7A21927 for ; Thu, 16 Apr 2020 15:47:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587052033; bh=otK5x4Ls3x9usVl63svp8ToBMJhcukjNtYux7ORX/Ps=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=TTuf4Tfn2ed86kH+jzpBcgxtRQJ/7Am0PqiTtINqJXJtbymwczXFZ7z6owkEycwVJ DcaZfhAb/RiLt2Pij5QG1fkH1kbvPdVxS+RHxNlBnPuDc3+zKQDhRsLK7IdiQkozmu lUtxC3u94fz/87QID1RfeS00B6MyYQhmJpHAxeAE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2635437AbgDPPrM (ORCPT ); Thu, 16 Apr 2020 11:47:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:45586 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2896884AbgDPNeK (ORCPT ); Thu, 16 Apr 2020 09:34:10 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 70BF121BE5; Thu, 16 Apr 2020 13:34:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587044049; bh=otK5x4Ls3x9usVl63svp8ToBMJhcukjNtYux7ORX/Ps=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c9V636ZSbHHy9VKl3wIxDywfTfiQzipMdhoQY/xB563IgbNp3n/PJDCrTzbhA00z8 NzCmsZKtTZ54OJ+F4ZGqKXi7RFncjg07l8yqb0wJozf8BgViAUwAPwFTy2NCwnFl2B CqTlL0Zr9MzLoUc3ceR6/9lLza9ZlXWRL4ADl36I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, chenqiwu , Kees Cook , Sasha Levin Subject: [PATCH 5.5 059/257] pstore/platform: fix potential mem leak if pstore_init_fs failed Date: Thu, 16 Apr 2020 15:21:50 +0200 Message-Id: <20200416131333.344416418@linuxfoundation.org> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200416131325.891903893@linuxfoundation.org> References: <20200416131325.891903893@linuxfoundation.org> User-Agent: quilt/0.66 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 From: chenqiwu [ Upstream commit 8a57d6d4ddfa41c49014e20493152c41a38fcbf8 ] There is a potential mem leak when pstore_init_fs failed, since the pstore compression maybe unlikey to initialized successfully. We must clean up the allocation once this unlikey issue happens. Signed-off-by: chenqiwu Link: https://lore.kernel.org/r/1581068800-13817-1-git-send-email-qiwuchen55@gmail.com Signed-off-by: Kees Cook Signed-off-by: Sasha Levin --- fs/pstore/platform.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c index d896457e7c117..408277ee3cdb9 100644 --- a/fs/pstore/platform.c +++ b/fs/pstore/platform.c @@ -823,9 +823,9 @@ static int __init pstore_init(void) ret = pstore_init_fs(); if (ret) - return ret; + free_buf_for_compression(); - return 0; + return ret; } late_initcall(pstore_init); -- 2.20.1