Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2235448ybi; Thu, 20 Jun 2019 11:20:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqyjycnF0SbSBiJKq2x5td1kQEfKPFYq0YziFm0OSawZdCD7dzWMIHTZFYuEHAfG3jlhF3nk X-Received: by 2002:a17:902:e2:: with SMTP id a89mr127312838pla.210.1561054843970; Thu, 20 Jun 2019 11:20:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561054843; cv=none; d=google.com; s=arc-20160816; b=e6cwaX2umcMFwiBZLUtcxk+2Gi364YhTaEEzSqmM+7gtQArOxKOMAq11DTOSjLyaFi TXiV9qKLflLVkdruTeBRoKeECFBD82IIZfdcgd+4nRUa5Xc8yPLjBQIYmlu4RuyxOKV9 VIYWJLb30WImVgaLERZA8Nl38jhNSpJe+ulEhITbH1J9YeqzmxpJeZtogv5tMNX29tFA QA9EbpdEyLKXOFdGs75HVr2Z6Comz9BUQMh7upu5yM3Ej56YaHbrWp861n3x6vEVNh4e +IyNvHZQH7mD7XqvHiF/3xZPSZ4FqmTu7oEHM30XMZRBZ/XAeBTvkY7IFq3A0mieDb+m gKMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=M7Q+45lrPCXL7KMaBb1zMxuVJPFtkXwB7md+aJNC8Yo=; b=rwfZBWPUOmfE3W1QHMOvWAI3UskI3pK1HrlkSf+nRvIC0XMTpykDAiV9oGy3R+z6pK oX/lYMIEjb+1ZE9zyLB0tuuuDVNkC5z24DQ4rnmR+emb/19jPfEWAC9+8O6BzVORKpmP 4piHoEfIiDZ9F/RIjVb6+994nMRmbxzPRZwUkY/31Kg2zmm9RUsy3zOB+TStkgEKt2jP R/wEmrTVWRdUyJEA91QSVF1IfPDRjvFrCZXgZP8YKm91/fthgQESjQe9pSFO/QH5UMZy NExPn56HxASmorR5IV3HEH/Ld8jS9MWD787q0ZVObYNVsvCYC+jZvkNHAo0KqCiTwS3C HxIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ZSkkx5H7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q15si165816pfh.284.2019.06.20.11.20.28; Thu, 20 Jun 2019 11:20:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ZSkkx5H7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728825AbfFTSQP (ORCPT + 99 others); Thu, 20 Jun 2019 14:16:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:45312 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729505AbfFTSQL (ORCPT ); Thu, 20 Jun 2019 14:16:11 -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 75E1F205F4; Thu, 20 Jun 2019 18:16:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561054571; bh=tD2RAf82b2kqlaZW6P4sPKJfmUPs4KxIDFFk2dbs47s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZSkkx5H7UNo3EIquZ3aHaiO3rlonUaDJur2Pf1sDclnrYf27AGEcRrW1aMkDBprtN PrEgyRhQpnU1wOeyGptSLFKesMKO3IpptDXvXN3V6mLeBOWX/bVRJzRtfPRmAvkqKv 118lGonJmdAeXFFVbi57EK6wzyabK8y26clIj54A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gen Zhang , Paulo Alcantara , Steve French , Sasha Levin Subject: [PATCH 5.1 74/98] dfs_cache: fix a wrong use of kfree in flush_cache_ent() Date: Thu, 20 Jun 2019 19:57:41 +0200 Message-Id: <20190620174352.941043088@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190620174349.443386789@linuxfoundation.org> References: <20190620174349.443386789@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 [ Upstream commit 50fbc13dc12666f3604dc2555a47fc8c4e29162b ] In flush_cache_ent(), 'ce->ce_path' is allocated by kstrdup_const(). It should be freed by kfree_const(), rather than kfree(). Signed-off-by: Gen Zhang Reviewed-by: Paulo Alcantara Signed-off-by: Steve French Signed-off-by: Sasha Levin --- 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 09b7d0d4f6e4..007cfa39be5f 100644 --- a/fs/cifs/dfs_cache.c +++ b/fs/cifs/dfs_cache.c @@ -131,7 +131,7 @@ static inline void flush_cache_ent(struct dfs_cache_entry *ce) return; hlist_del_init_rcu(&ce->ce_hlist); - kfree(ce->ce_path); + kfree_const(ce->ce_path); free_tgts(ce); dfs_cache_count--; call_rcu(&ce->ce_rcu, free_cache_entry); @@ -421,7 +421,7 @@ alloc_cache_entry(const char *path, const struct dfs_info3_param *refs, rc = copy_ref_data(refs, numrefs, ce, NULL); if (rc) { - kfree(ce->ce_path); + kfree_const(ce->ce_path); kmem_cache_free(dfs_cache_slab, ce); ce = ERR_PTR(rc); } -- 2.20.1