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=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 C4507C433E0 for ; Tue, 2 Jun 2020 01:31:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A5326207BB for ; Tue, 2 Jun 2020 01:31:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728586AbgFBBbR (ORCPT ); Mon, 1 Jun 2020 21:31:17 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:5835 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725825AbgFBBbQ (ORCPT ); Mon, 1 Jun 2020 21:31:16 -0400 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 4E73E4485C0BB0CF2468; Tue, 2 Jun 2020 09:31:12 +0800 (CST) Received: from huawei.com (10.175.104.175) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.487.0; Tue, 2 Jun 2020 09:31:06 +0800 From: Zhihao Cheng To: , , CC: , Subject: [PATCH v3] afs: Fix memory leak in afs_put_sysnames() Date: Tue, 2 Jun 2020 09:30:45 +0800 Message-ID: <20200602013045.321855-1-chengzhihao1@huawei.com> X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.104.175] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Signed-off-by: Zhihao Cheng Cc: # v4.17+ Fixes: 6f8880d8e681557 ("afs: Implement @sys substitution handling") --- fs/afs/proc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/afs/proc.c b/fs/afs/proc.c index 468e1713bce1..6f34c84a0fd0 100644 --- a/fs/afs/proc.c +++ b/fs/afs/proc.c @@ -563,6 +563,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); } } -- 2.25.4