Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2657365pxa; Mon, 17 Aug 2020 15:43:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzVHXV8QMl1eYfmvqkTz3jAK8Vtvw0vMzQHJ9Cx6i5M6x1/gK6zMB5a+n/9Oq4TkbryA6w6 X-Received: by 2002:a17:906:698:: with SMTP id u24mr16858418ejb.57.1597704202971; Mon, 17 Aug 2020 15:43:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597704202; cv=none; d=google.com; s=arc-20160816; b=o8B/1/AihwwwmxzbeUbzRP4ktSb1vb/SPbWZeRV5/vyOhqf9ZREHmyfCsLB2bAaRaN kFldVoRQ48q3+Kn/xgbjRENY1gPU+UvcInHN4VEAvI4TdPv9Tzz1f2ufJf/Nx9mjzjsv lI9ovaS6fbirk90o48KLLD5Iwg1ldqBnlYgSphBz3cZS9EBMzSjIqTIq/3+185+pafOX 9ywe8+hffeEsEsMYfM7e3ty7BhCv1ZvJZE84eNwUJrWbou9LP0K2oxIPebs0fGZtkjVb j2cQGaM3fKAMP7ykmKW+Hpp22Vekod/mg645wbY3zQfxjglKvjcLtUN4iSoDTWixUQGW l2mQ== 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=z7evlSQL3KB1A65nkEphWAT5KjOluG14X7LPg4NO8eQ=; b=gUPv5UD03l3dUOMJTO+7e7Q9xiI7rx2mg/3M6z3rfKmwBLBTRyVcLg6/HHH+kiThOC ZfgPQq1+OX/r4zFPRAuylL5JFFmebnKwuAmG8RDGUzMdrhdQHWE49yS+yrjklbhrEPsG YbF0TIdw7ECCp4gI93fNkXzgCAN8/07YCJxEI7Oo0+OpSEdxMHtpMwyLtyeJrB0My4Pa M7RHQHGm+2F9fOpYsbS0gBrxnnLccCCDd1t4OZqW6KhzC8BszF6MzPrLNH9R9zx+ou6g Bs1YEHPEpSD4HrVYvt8ceCm2T8Ll/3CmiSK0Ot2vYU1E9SWNkYG1W6k4QMVnUKdJ9Yw5 pe0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="K3/yy7qc"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id di8si10622136edb.395.2020.08.17.15.42.59; Mon, 17 Aug 2020 15:43:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="K3/yy7qc"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391157AbgHQSlr (ORCPT + 99 others); Mon, 17 Aug 2020 14:41:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:44934 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730674AbgHQP5V (ORCPT ); Mon, 17 Aug 2020 11:57:21 -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 DCC452072E; Mon, 17 Aug 2020 15:57:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597679841; bh=8cLVw7nzYeeb/D1UEPPeffAQwZifocd6+H+cQwWUp8A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K3/yy7qc8+tRY8bKb/Dwj3e1wLNyMlEWoxR/+8DZ5DLoWFpSVlzGROx7CgPCpw/ft TkCrg+hptu3d+tUD/2rqsPYP7HdLGnsRrLdfoTbj7cY6RL3zEQ2y9t0CtJky5utvIC Mr3xhyUFCKv6n1pS/X71iYY29C9BjmN24R26jvGA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zheng Bin , Dominique Martinet Subject: [PATCH 5.7 351/393] 9p: Fix memory leak in v9fs_mount Date: Mon, 17 Aug 2020 17:16:41 +0200 Message-Id: <20200817143836.628088230@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200817143819.579311991@linuxfoundation.org> References: <20200817143819.579311991@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 From: Zheng Bin commit cb0aae0e31c632c407a2cab4307be85a001d4d98 upstream. v9fs_mount v9fs_session_init v9fs_cache_session_get_cookie v9fs_random_cachetag -->alloc cachetag v9ses->fscache = fscache_acquire_cookie -->maybe NULL sb = sget -->fail, goto clunk clunk_fid: v9fs_session_close if (v9ses->fscache) -->NULL kfree(v9ses->cachetag) Thus memleak happens. Link: http://lkml.kernel.org/r/20200615012153.89538-1-zhengbin13@huawei.com Fixes: 60e78d2c993e ("9p: Add fscache support to 9p") Cc: # v2.6.32+ Signed-off-by: Zheng Bin Signed-off-by: Dominique Martinet Signed-off-by: Greg Kroah-Hartman --- fs/9p/v9fs.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) --- a/fs/9p/v9fs.c +++ b/fs/9p/v9fs.c @@ -500,10 +500,9 @@ void v9fs_session_close(struct v9fs_sess } #ifdef CONFIG_9P_FSCACHE - if (v9ses->fscache) { + if (v9ses->fscache) v9fs_cache_session_put_cookie(v9ses); - kfree(v9ses->cachetag); - } + kfree(v9ses->cachetag); #endif kfree(v9ses->uname); kfree(v9ses->aname);