Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1060703ybl; Wed, 14 Aug 2019 10:05:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqz0bdZOOmHbRRo1C5sIPjTvc8LJCSO0zQ5Tkh41Ue+wlKmDzTWvvf4L5hl2+7YikOKOkQGG X-Received: by 2002:a63:394:: with SMTP id 142mr164399pgd.43.1565802317867; Wed, 14 Aug 2019 10:05:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565802317; cv=none; d=google.com; s=arc-20160816; b=CncExfPgD5oxRdNrcfEU+AWFjoNctbrHlgIXGrXALtvy9BZLW4fNLwOSjq3UQESPCf rfBjwd5/FKMhQhxnHvkyl7xBGvtSQ5VjyVLW/+VEKHEQf93idPlYsz0XaRVPukbf/k7r JB+JLk+EbMagfs0MNYFgJa4PJH1wV1ewze4F8wrtlfC+8GDfXxajDdIjPT7xydeCa4W7 +HIrCFM8HO2H9ucJj3XyTn0q4w188JnzommsEGUlOZsLLZ5XOyFs7w1cZiEu7ehHYSGM Ypc7HRjGGmKGl2/4yc3aYliXVOqdwd2srjY1blN2Qtmu7JmAjpMVS29UidzzHbQ7o/ek H6UA== 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=Rs989NAqH5gALQPTDDY/eBWjfJ3tDcDUFvfdof259Rw=; b=ueietwqV79lvVLIhjVGVWe+OIlmbFB9VPNtaVQxtflBmdCxnk6L215ku88t1H4ivu3 YXuPqIIIdq6c1ErMn7n5IzzZwa6vG8MaB8Mo2KvuZ7jfzre3r6Jh+K8dm2AUQlnzhvC6 mVgrYnWFku+Ct9rBzS+6RLSBzDkhdw+vDqlsfgt4liwG2yXpO8pbdveBhyYNJTYl1JDR mRZdf87VWSTOCss23UpD3Mo/Zp8RVX8ibSWnU363+/l2tct31ecHA21QIoUNKcNNY/4n cgrQu42IzcF7HyNHBTgnMDx6btFyUwRIfUaSkLh0JabqhR65b4716VDPuVKBZeUSN0km zIyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=UJ3Vy6lj; 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 6si167142pgb.201.2019.08.14.10.05.00; Wed, 14 Aug 2019 10:05:17 -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=UJ3Vy6lj; 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 S1728508AbfHNRDm (ORCPT + 99 others); Wed, 14 Aug 2019 13:03:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:52356 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728992AbfHNRDk (ORCPT ); Wed, 14 Aug 2019 13:03:40 -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 A6F472084D; Wed, 14 Aug 2019 17:03:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565802220; bh=vpBd45e7Qe4nLqVfYVxDGYhbnKSpfxJvRruOEeMplXM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UJ3Vy6ljjhMe9tVpBy+xYkAOMvV7htVdt1KMvdQ2kAuUd0JiaOJ2cuRic5sbwywSx JjHnEyGaLXLOqHTyCOVHWwKO9xAQ4c2JCK7OUIK0776gfATkVbW4PzzyuRB8VAcPer tN1/FAPuT86fEsKE//qKZYNCmyoxxfEVgWlFqA/s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Li Jun , Guenter Roeck Subject: [PATCH 5.2 041/144] usb: typec: tcpm: free log buf memory when remove debug file Date: Wed, 14 Aug 2019 18:59:57 +0200 Message-Id: <20190814165801.548004615@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190814165759.466811854@linuxfoundation.org> References: <20190814165759.466811854@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/tcpm.c | 9 +++++++++ 1 file changed, 9 insertions(+) --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c @@ -586,6 +586,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); }