From patchwork Tue Jun 23 19:57:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 223459 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=-10.0 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 DB2C5C433E2 for ; Tue, 23 Jun 2020 20:31:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AF1092072E for ; Tue, 23 Jun 2020 20:31:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592944280; bh=YWIkgcKh2plRVdX2ypmWeVogabRplaPzmujWVysBTBU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=WQW91gTTHM6+c2OXAoGmdNJToZhSb0Unwli0XF35ULfZbK1cJR9wI0aCifIxTVDFk iCa8O7hZqaRTmV8fmKQqNkus9eT0UcaSnR853Vy3lOl3vLuDvxCgef4qzlcWleLvzL oRokk5hSPi1Q6vzAE7UpwOWRhORDO558vTD3wtIk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388253AbgFWUbS (ORCPT ); Tue, 23 Jun 2020 16:31:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:51762 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388282AbgFWUbR (ORCPT ); Tue, 23 Jun 2020 16:31:17 -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 592A52064B; Tue, 23 Jun 2020 20:31:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592944276; bh=YWIkgcKh2plRVdX2ypmWeVogabRplaPzmujWVysBTBU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L7bWXoLhHKJE8sMNJHUQdR6wcD1xRUp4pwtJNgyT/jW4yd3QoUJC1SsJCpf9UXQjT NJjxxgXD6TvbHeEFr9vD/ZVE+OPqBG49QnMtE8PuQ8fc4FC/NQKMmxiqY7rClJdu2R qd44JtHuaLzrbYjB4/WAWbLDLGx6tIhhv01S3d4U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhihao Cheng , David Howells , Sasha Levin Subject: [PATCH 5.4 242/314] afs: Fix memory leak in afs_put_sysnames() Date: Tue, 23 Jun 2020 21:57:17 +0200 Message-Id: <20200623195350.505331560@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623195338.770401005@linuxfoundation.org> References: <20200623195338.770401005@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Zhihao Cheng [ Upstream commit 2ca068be09bf8e285036603823696140026dcbe7 ] Fix afs_put_sysnames() to actually free the specified afs_sysnames object after its reference count has been decreased to zero and its contents have been released. Fixes: 6f8880d8e681557 ("afs: Implement @sys substitution handling") Signed-off-by: Zhihao Cheng Signed-off-by: David Howells Signed-off-by: Sasha Levin --- fs/afs/proc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/afs/proc.c b/fs/afs/proc.c index fba2ec3a3a9c9..106b27011f6d5 100644 --- a/fs/afs/proc.c +++ b/fs/afs/proc.c @@ -562,6 +562,7 @@ void afs_put_sysnames(struct afs_sysnames *sysnames) if (sysnames->subs[i] != afs_init_sysname && sysnames->subs[i] != sysnames->blank) kfree(sysnames->subs[i]); + kfree(sysnames); } }