From patchwork Tue Dec 18 06:37:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 10734857 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A2F0F924 for ; Tue, 18 Dec 2018 06:29:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 820D429BC2 for ; Tue, 18 Dec 2018 06:29:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6FB2029BCA; Tue, 18 Dec 2018 06:29:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 136B929BC2 for ; Tue, 18 Dec 2018 06:29:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726324AbeLRG3e (ORCPT ); Tue, 18 Dec 2018 01:29:34 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:45225 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726316AbeLRG3e (ORCPT ); Tue, 18 Dec 2018 01:29:34 -0500 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 41FCCDC0ED274; Tue, 18 Dec 2018 14:29:31 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.408.0; Tue, 18 Dec 2018 14:29:24 +0800 From: Wei Yongjun To: Steve French , Paulo Alcantara CC: Wei Yongjun , , , Subject: [PATCH -next] cifs: Fix to use kmem_cache_free() instead of kfree() Date: Tue, 18 Dec 2018 06:37:02 +0000 Message-ID: <1545115022-164840-1-git-send-email-weiyongjun1@huawei.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-CFilter-Loop: Reflected Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP memory allocated by kmem_cache_alloc() in alloc_cache_entry() should be freed using kmem_cache_free(), not kfree(). Fixes: 34a44fb160f9 ("cifs: Add DFS cache routines") Signed-off-by: Wei Yongjun Reviewed-by: Aurelien Aptel --- fs/cifs/dfs_cache.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/cifs/dfs_cache.c b/fs/cifs/dfs_cache.c index d20cc94..f745677 100644 --- a/fs/cifs/dfs_cache.c +++ b/fs/cifs/dfs_cache.c @@ -414,7 +414,7 @@ static int copy_ref_data(const struct dfs_info3_param *refs, int numrefs, ce->ce_path = kstrdup_const(path, GFP_KERNEL); if (!ce->ce_path) { - kfree(ce); + kmem_cache_free(dfs_cache_slab, ce); return ERR_PTR(-ENOMEM); } INIT_HLIST_NODE(&ce->ce_hlist); @@ -423,7 +423,7 @@ static int copy_ref_data(const struct dfs_info3_param *refs, int numrefs, rc = copy_ref_data(refs, numrefs, ce, NULL); if (rc) { kfree(ce->ce_path); - kfree(ce); + kmem_cache_free(dfs_cache_slab, ce); ce = ERR_PTR(rc); } return ce;