From patchwork Thu Sep 20 19:17:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 147125 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp2375927ljw; Thu, 20 Sep 2018 12:18:31 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaEvG2hbDsJHF7Qy1DOQbIyIlbsU1agtTxT2CixAvYls6adNz5/IACdHKuXFU5ky3xTs4mL X-Received: by 2002:a17:902:a405:: with SMTP id p5-v6mr40636696plq.222.1537471111546; Thu, 20 Sep 2018 12:18:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537471111; cv=none; d=google.com; s=arc-20160816; b=0YE6ECxbGd7US7hXlR2i43Sg9503po2BuaBe2Hpk+Q86ZlhofYf66r+6Zd7dAcebUv I7h+f6BNCg7TtrFkV7cDfkGgmKj88whCzMQUefui4eCA5KJo0kXhlULkV6L+GepHvxos V7etWZOK91cDinERXlzUs+LO16nGSVOxUC4VXEkpIoFCusXm7iYDXeijUxWNUtWPxjHu fx1MVdB5qn7vVrKcEQrswVmSc46QTVFWI1ubX8tawwYQx9qDYUxITM/2WpDlMORgcfgn 5r4oBcqGxN+m1lJCcOAV0Gr4J+VDCe617CuNPupHbLcgJDVsXDR2EHZnOjrwwX3j917y jTbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=eF89dC211phJ/o1YWVyp4RY+3QE6f2Ht0jxF9gJ+Hsw=; b=egx1fgdv1n7Rezl8gly0QZZ8/bev4ib4eQ4Guj5syLUVD+qf2XyxUbBlnzWmHTAnO5 77a4PgOcyBo+r+oUiRnZZUZKT79PsVTNXdUu4mkHKLktvMPqoqWsCNk/035iyLQw0yDS uk8ZrJ2S6f6QlGUKuQ5PGWonR65f3sjsQJ4Yub9RzwIYepYTK7BC5P9NvaNCCpgtd174 umeuVyYZYvpfvE5OvEFCo9nNRiRPJASIk6kEt8ay661bKo73vqTeMc7EYoJ22n6exX5Y /XFjMADct5IsnRMgUvM+X8/9qYLdZvSRNFGcFOyQW+O/+s+DglF/E+Ur+qoZd4QEeSy4 HuTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IOiqhG0Z; 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=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t13-v6si26599001pfc.194.2018.09.20.12.18.31; Thu, 20 Sep 2018 12:18: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=@linaro.org header.s=google header.b=IOiqhG0Z; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388663AbeIUBD1 (ORCPT + 32 others); Thu, 20 Sep 2018 21:03:27 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:44164 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388617AbeIUBD0 (ORCPT ); Thu, 20 Sep 2018 21:03:26 -0400 Received: by mail-pf1-f193.google.com with SMTP id k21-v6so4811694pff.11 for ; Thu, 20 Sep 2018 12:18:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=eF89dC211phJ/o1YWVyp4RY+3QE6f2Ht0jxF9gJ+Hsw=; b=IOiqhG0ZxY4l4OUYmyy3hVpYx/Li3dpgxhA74liU/HAO4yMwDnWb5CrMBpgZqmCClb e3hD4OR839R5o2VElvqYOHaLxri0nwS5JpI2mzMLuGdaEzCCl3hpnk9ECkU0ya/beQzG VldY3GY2wRKJ8TuuG8eCLcR3SAiyJuaydqEm0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=eF89dC211phJ/o1YWVyp4RY+3QE6f2Ht0jxF9gJ+Hsw=; b=gjr2w2HfhjVh+tYZZbI1j+pRa8xMD5Nb1575YgJaZnNQUNtUahas7WKTraVf5PnK+g kY3XEZ6tkMhzQI22t6I/+wwsjfmiXkPyeHW0R2Dz4NsBsOTQk5OpMp/kgGRcLXrzMutX DNnVxbgKa+ZyFTy+OaGYFTPFi7D3DVFnfNhBGiwYmkTPv3ltYHEW/Ge8LBPkx63nHsk+ qa63HIEPMo05eANeocD8NIdZx7zEp1Ea+LyC6DIWZ3J9lQVkumdW7ABfO/mU0lJ+gR32 pel+ZdeaEu2nA9GlmYkLlZOv+toP3PuFzBcH3et+GkMLyW2Rm6okdaWQgc5GX+Zx5nW+ Kmhg== X-Gm-Message-State: APzg51BXBQRi/iSWIAjicPOKW8Wvuy94TsJ7V6/RqB0C11Jt/31SR2Ys KYwGGhTRnqW+Ti9y3fujykeQiw== X-Received: by 2002:a63:7107:: with SMTP id m7-v6mr37801119pgc.73.1537471107422; Thu, 20 Sep 2018 12:18:27 -0700 (PDT) Received: from localhost.localdomain ([209.121.128.187]) by smtp.gmail.com with ESMTPSA id k13-v6sm4424443pgf.37.2018.09.20.12.18.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 20 Sep 2018 12:18:26 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH 04/44] coresight: platform: Fix leaking device reference Date: Thu, 20 Sep 2018 13:17:39 -0600 Message-Id: <1537471099-19781-5-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1537471099-19781-1-git-send-email-mathieu.poirier@linaro.org> References: <1537471099-19781-1-git-send-email-mathieu.poirier@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Suzuki K Poulose We don't drop the reference on the remote device while parsing the connection, held by bus_find_device(). Fix this by duplicating the device name and dropping the reference. Cc: Mathieu Poirier Cc: Kim Phillips Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/of_coresight.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/drivers/hwtracing/coresight/of_coresight.c b/drivers/hwtracing/coresight/of_coresight.c index 28d3aef1660b..4b279f8fea0c 100644 --- a/drivers/hwtracing/coresight/of_coresight.c +++ b/drivers/hwtracing/coresight/of_coresight.c @@ -162,7 +162,9 @@ static int of_coresight_parse_endpoint(struct device *dev, } pdata->outports[i] = endpoint.port; - pdata->child_names[i] = dev_name(rdev); + pdata->child_names[i] = devm_kstrdup(dev, + dev_name(rdev), + GFP_KERNEL); pdata->child_ports[i] = rendpoint.id; /* Connection record updated */ ret = 1; @@ -172,6 +174,8 @@ static int of_coresight_parse_endpoint(struct device *dev, of_node_put(rparent); if (rport) of_node_put(rport); + if (rdev) + put_device(rdev); return ret; }