Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1068814ybl; Wed, 14 Aug 2019 10:11:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqx6AkiwXp7y7yfVeX784ryaPUlOnghA6Jk65tGZnhp3zCnpEjH54bUWqzypqErXi2Y5m+Sc X-Received: by 2002:aa7:9dcd:: with SMTP id g13mr1030087pfq.204.1565802706445; Wed, 14 Aug 2019 10:11:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565802706; cv=none; d=google.com; s=arc-20160816; b=yQ6iTdlONiPGnaPKpnG9tmnpOJLcd9zIrdrFUqd87Z6INRywpP0Vr+d74p5epeJVow vVRF00KrwU2Ka+wqMcRToS7ooCTqmZ2Jma8MgtkcSbP2+HaD4PfMESvoV6RHq1+DfbhC M/1RX32WlPA8UqSrk+0Klgo29I0JAmuQuVSXqUCPq1d6G2V4q5JT9YSAgg47CEzFgUiZ CPKTzwjCGFDurssln3nYlknTtW/nfQ70hf+l5zbVo6XlBK1GTy4EamLJ/xLyI8kPGeFU x8Cj1XknSgCdKZxSVG8PHjj6Q63xvrFogtpboMKIwCT5D+WXrVoAXV1P7am/B3oqfUEV Wjlw== 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=aBdcABei3wtaio/F/QQS1eYdUi+iJawlSpKKWZl16wU=; b=Ns/vXozkhPnw04+Q4rdTyW/Ntg0X9ItothFNP9FhDnYgvePsGOAPmZGTgPjbaJgp2G OAzShkZNONP7nrsQUwIJ5lIKMFTGAf6zYZwClVcY471oPKIJX/vIwIFQJiRsrAdF76s/ Xfvsuay2zT8NURnoriO/yb61g6IX94pUqO/4VesscMDj7uOlVER5JwS2zLuOab+kGPOB Cv/LLEetF9PSii6/IHTPICvji5JTgnmr8MuTYAoCfeo5iauIaKqL22e0kKjuv4x/rg9N ZGl3wnQkzIxSuEsyIzSNWBZJlpZfCO1wOPIN7RJZOqaplNjg/VbUCmJsVb+gekmgOGaF X4Gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CWIk+DLY; 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 16si65362pfc.213.2019.08.14.10.11.30; Wed, 14 Aug 2019 10:11:46 -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=CWIk+DLY; 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 S1729080AbfHNRJV (ORCPT + 99 others); Wed, 14 Aug 2019 13:09:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:59618 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729542AbfHNRJR (ORCPT ); Wed, 14 Aug 2019 13:09:17 -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 623CD2084D; Wed, 14 Aug 2019 17:09:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565802556; bh=TYFy08fBWSEElyvDyVwKiGkMT0KMuV3TrvCCJW8HtAY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CWIk+DLYZ9wcnFHTO3MyO9ENLPKio9y9/GEz6Y5knCVdOgmTcD48+9FTvpae7P4AT tjlQ3nnC0hq0Q72vy07WRNijrh/hWtBEwNzKVl+fWbq44aUx8V2Zex6fl7PFBlYYp0 LoDszyMaFhul1i8EzVHsvX5C6mUjzEFVctqmoQZ4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Li Jun , Guenter Roeck Subject: [PATCH 4.19 27/91] usb: typec: tcpm: free log buf memory when remove debug file Date: Wed, 14 Aug 2019 19:00:50 +0200 Message-Id: <20190814165750.843608582@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190814165748.991235624@linuxfoundation.org> References: <20190814165748.991235624@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: Li Jun commit fd5da3e2cc61b4a7c877172fdc9348c82cf6ccfc upstream. The logbuffer memory should be freed when remove debug file. Cc: stable@vger.kernel.org # v4.15+ Fixes: 4b4e02c83167 ("typec: tcpm: Move out of staging") Signed-off-by: Li Jun Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/20190717080646.30421-1-jun.li@nxp.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/typec/tcpm.c | 9 +++++++++ 1 file changed, 9 insertions(+) --- a/drivers/usb/typec/tcpm.c +++ b/drivers/usb/typec/tcpm.c @@ -585,6 +585,15 @@ static void tcpm_debugfs_init(struct tcp static void tcpm_debugfs_exit(struct tcpm_port *port) { + int i; + + mutex_lock(&port->logbuffer_lock); + for (i = 0; i < LOG_BUFFER_ENTRIES; i++) { + kfree(port->logbuffer[i]); + port->logbuffer[i] = NULL; + } + mutex_unlock(&port->logbuffer_lock); + debugfs_remove(port->dentry); }