Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4420428ybi; Mon, 27 May 2019 18:14:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqzTjsc4A2apFGX96Mbe3/xenYRg6vqIjzNPMVuzsRfdMawt0tI3F7l7o3AivRTqAhh7Cxro X-Received: by 2002:a17:902:d715:: with SMTP id w21mr116176837ply.234.1559006071843; Mon, 27 May 2019 18:14:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559006071; cv=none; d=google.com; s=arc-20160816; b=x7cCsZeXmxaa8yyWkTR9/xKuLLx8IHbjvziEKneiyKheBgUzIP9jjQShLl7jajM40I 8zS59IhQsrIpHqrlWDNC6otkpGB9xfvOi83rpYnsbokxSfFBfAQjQL8wlq6eL0TXqc42 PC3fE7gqoeJzgnv4KR93DQy7QOMQmymM29Mu1JCBVXbCo4clUTK93dofAqs8d1AtB2JF h9qePqAcmGbxAl9ua2hjlE/OcGpiTjc6vdEVev6bdKUn2Vpx2u2xZjphACVHatTUomLQ gXHhbBXDNfFF5vossSgdNBqAGQLNDc5aj0/urDcSQ/KpOOuX6YA978bBO6cr9O5KBGqD p29w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature; bh=kJoaVY4+Sc4R80CmlMM5gY/c+co5CrzbP+Oe/Lgmn0o=; b=oksDE1csvXAjr25W0vYyPagUerzTZz3In41sjdBCR7FMROkeQhJoDJKQtU/K+CsGlN vnoViUJDWyEKttn8CXmsf+zy1wVBb9Ff6pC1H+2axEU2xgcL8uuOAHWA4Z4sxk42jG+O 3sJJ/gmD18LsFMk7c+eDxiyvpSZUlC3gF3S28CYeaEZoIsCToedh5wc94xG4g6KLaBW3 emec3r1u1OymD0hrWMszNX7TnTlVYtiC7cQ9SlsXmnjhaODiA1/OMKsl8vMxPoCihx70 IKCKRwJeaWg2Vo2n/p+hJjHpXk3Qf1XeBM0MarTHwZSU5layH/AJvSJYRNUhQVxb/zon Y5WA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ONA1eRsU; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s4si8639315pgk.594.2019.05.27.18.14.16; Mon, 27 May 2019 18:14:31 -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=@gmail.com header.s=20161025 header.b=ONA1eRsU; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727665AbfE1BNK (ORCPT + 99 others); Mon, 27 May 2019 21:13:10 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:36737 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727018AbfE1BNK (ORCPT ); Mon, 27 May 2019 21:13:10 -0400 Received: by mail-pl1-f194.google.com with SMTP id d21so7606158plr.3; Mon, 27 May 2019 18:13:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=kJoaVY4+Sc4R80CmlMM5gY/c+co5CrzbP+Oe/Lgmn0o=; b=ONA1eRsUHXpj3191QHoHKIlANLkvzRTLYH+rGr/P7qjuk2bPvZwdzvRHR43GVF8sF3 2pfz69hp0iffZFDkTQ3/dZ7ZZmXucnjabmjSDYhnPM/fJ9WGit178nG7uBg+AuYfjZ+i c/rZVn8eY2iOLlCmUCPiOBJdEIphrvmwX+6AtMbLB+x6y88k6UvqdmQVbJIY1JWfnaJg cYiB96znUKHzqpVQG59Aw/OUY9huW5oC5brPrA7WCwXH3zrNgUtEikID30zcw7FtjzrK 6nIhBbIPZE/W2wUQGZZV6WI4mxPs9j53BYFTS4kueL6Lyp5zsW/HZ8y0qKOHL70J4VV/ /wUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=kJoaVY4+Sc4R80CmlMM5gY/c+co5CrzbP+Oe/Lgmn0o=; b=nFQSmq24/8XAOZ8U0B20S4m3SUpi7cx1ZKJ8rcEKeixOOBOYFne2FP7U0YDD3jaaDl 4lsB6CuX2qPMtnucPXIk3HS0S5JuNYjYHs3MiNn5sev09wdbEL6k3I9kq9/3ITL8aEGn sSDGtlmrd20SLst0u268REdmShOkokCm8+QpsAN83e77z512+WLXCepVAmkV8AxLlLvB A6rLQlN0xBVhiO62ghdg27HPyP5pVsAu9yEJChggdL6qWVSaA6+eYpeW4Wks/4YZxw2i COfDi/Xwbop4jrNJRYe2zfUjh1Ny72+VdVQlcp3SK+Wt+NomvGf1YHkFvmFMq5XNciPw FVzA== X-Gm-Message-State: APjAAAU8DYu5wtQ9hIheph/GcEcC3Mqji+1kw9Ob4sBqcykpYjRV5NYf 2stEq6+J4V38yx/Hicn6xes= X-Received: by 2002:a17:902:4381:: with SMTP id j1mr30770425pld.286.1559005989583; Mon, 27 May 2019 18:13:09 -0700 (PDT) Received: from zhanggen-UX430UQ ([66.42.35.75]) by smtp.gmail.com with ESMTPSA id 80sm6841049pfv.38.2019.05.27.18.13.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 May 2019 18:13:08 -0700 (PDT) Date: Tue, 28 May 2019 09:12:39 +0800 From: Gen Zhang To: sfrench@samba.org Cc: linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-kernel@vger.kernel.org Subject: [PATCH] dfs_cache: fix a wrong use of kfree in flush_cache_ent() Message-ID: <20190528011239.GA12886@zhanggen-UX430UQ> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- diff --git a/fs/cifs/dfs_cache.c b/fs/cifs/dfs_cache.c index 85dc89d..e3e1c13 100644 --- a/fs/cifs/dfs_cache.c +++ b/fs/cifs/dfs_cache.c @@ -132,7 +132,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); @@ -422,7 +422,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); } ---