From patchwork Tue Jun 23 19:58:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 223314 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=unavailable 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 A1569C433E2 for ; Tue, 23 Jun 2020 20:59:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 74C2F20702 for ; Tue, 23 Jun 2020 20:59:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592945965; bh=M5b3VYofXKUdsZ3mPHAW68HmE9bw1kEkqwELp613G/k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=gINcGy3MV8pz7lDERwxTag/S3ifRka/yNAZuJx7pfZoB440CIdN46HUqD7lj4AFN5 4z1ltOoHXLcbo6Pw6n7dE0hFWJq4AUzVd2WlfrROdhIXt/0L9AD4QDv2B6wNyXE4ON ZS6UqfSBCwA/sBkdZVub3JVwbqpexuUO8YPdHCns= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392155AbgFWUlB (ORCPT ); Tue, 23 Jun 2020 16:41:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:37326 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389939AbgFWUlA (ORCPT ); Tue, 23 Jun 2020 16:41:00 -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 9D17920675; Tue, 23 Jun 2020 20:41:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592944861; bh=M5b3VYofXKUdsZ3mPHAW68HmE9bw1kEkqwELp613G/k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uUlMW/8ZjrXyGHhAx+VwSZLAnK2skmmr0UDuwjyD2yXiDJ1hnBPiYtudz7ZYCIlNZ fKysQ7tIVDzD/smp6B3WwHCTY+zqahbzVtRYb1sLO0ANvfc7d2B6APzWjGGIKiiH3b MfJVLtBRRdXx185YJPsNCFuQbGITtM2aM5cEHX/Q= 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 4.19 153/206] afs: Fix memory leak in afs_put_sysnames() Date: Tue, 23 Jun 2020 21:58:01 +0200 Message-Id: <20200623195324.522836049@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623195316.864547658@linuxfoundation.org> References: <20200623195316.864547658@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 9101f62707af2..e445c02dea3df 100644 --- a/fs/afs/proc.c +++ b/fs/afs/proc.c @@ -512,6 +512,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); } }