Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp275704pxx; Wed, 28 Oct 2020 04:46:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwrsQq+G59LHsRth1y8+JRcN1k4+2/Mfqr2wEJExsN5GJ3Acq0+iNp4M11CLh+ExMo5OPrD X-Received: by 2002:a17:906:141b:: with SMTP id p27mr7381615ejc.205.1603885596418; Wed, 28 Oct 2020 04:46:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603885596; cv=none; d=google.com; s=arc-20160816; b=I/CrErziF6vhXz/iW0fU3OSYhE6wuSFWR5cuJDBKLaBAdpsJ8QLhlxfNf2cSJ0ZAO8 CE6N54IDFq4v3NdyrHz/1ZheTu5d7Wfy1r48Eb9dCxvU6GE562JF0JC3M8663kxM3Lg4 Z0KGQOhopPUEyfMl9POv3VBoF8rKgZk+VgjctrDd3nM1+/4RN8zWBVmc9IXD4PaQ1Qmw sd9lpNCRWYhVKQxrqYgKJOGn+aeDHss5TXwHzeGuvM3EWAH2v0ycMBLF2/SC3Of4KvGY tMLRvtuKQ6t0HcA3EUGpWwc4fuBQqeElm1IlrxF5eBfrUr4J3Hg60R1SxaCvXUG5b+Ch AztQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=uLDZBepwH3w6nJ0eycpvIA7wuD1b9d1fyD8QqIQJJBE=; b=RCWn+Rf035OWpLETFXdKIilIRXCoiZWtMoNH5nIIZjlWaqUT6YdqI02UIQDrVK3pDI M2zvVaIrqkWHNzScTZChqmwKoSpWuK5izeM7RbywkO/+E+FY+IMDN3cBACAIJ+mdPaBG uMshnMTkuTYBKGHlS16hXZXNc17UxdzYeg00ob5N5W4SJynRDhUOr61tj+MfVut9js4p OFLtaPWwMVnRwgArrZMh9OGLbAAkcSTYWk2nj6qNBKNFHdF/2VpLArEb7g9zUT7ZB8+Y Kzc8quFnErFvQm+kWhiJMpVy8S3K3Fa8PoGFRIgCgTr0OJNgsDuOYDLvh64BzJ9lVdOp XPwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=BRprXJuY; 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 jr1si3058858ejb.164.2020.10.28.04.46.13; Wed, 28 Oct 2020 04:46:36 -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=BRprXJuY; 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 S1794379AbgJ0PLc (ORCPT + 99 others); Tue, 27 Oct 2020 11:11:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:36182 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1789384AbgJ0PCG (ORCPT ); Tue, 27 Oct 2020 11:02:06 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 12DA220715; Tue, 27 Oct 2020 15:02:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603810925; bh=V6WCZhbYK8PM3SlyYU26MRyCWmQLC97n29Y1qJ48Kkg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BRprXJuYXMTGtdJigev0mTzz0/eHBY77p30b5WPrSxSLKOFj5U9NSblUiqEwAXVPL iMBSflmf+xq2U0V2RgfC7bcJtkUucM2EqUC1cntRnIdAzLcDHaKB5XXU054rRi5LxX FEnvfsF6cqrucPy6l9T63aBoiGlkz34NYl78Z/+Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tingwei Zhang , Mike Leach , Mathieu Poirier , Sasha Levin Subject: [PATCH 5.8 281/633] coresight: cti: Fix remove sysfs link error Date: Tue, 27 Oct 2020 14:50:24 +0100 Message-Id: <20201027135535.857607134@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135522.655719020@linuxfoundation.org> References: <20201027135522.655719020@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mike Leach [ Upstream commit 1cce921bce7dcf6fef9bdfa4dcc9406383274408 ] CTI code to remove sysfs link to other devices on shutdown, incorrectly tries to remove a single ended link when these are all double ended. This implementation leaves elements in the link info structure undefined which results in a crash in recent tests for driver module unload. This patch corrects the link removal code. Fixes: 73274abb6557 ("coresight: cti: Add in sysfs links to other coresight devices") Reported-by: Tingwei Zhang Signed-off-by: Mike Leach Signed-off-by: Mathieu Poirier Link: https://lore.kernel.org/r/20200928163513.70169-18-mathieu.poirier@linaro.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/hwtracing/coresight/coresight-cti.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-cti.c b/drivers/hwtracing/coresight/coresight-cti.c index 47f3c9abae303..92aa535f9e134 100644 --- a/drivers/hwtracing/coresight/coresight-cti.c +++ b/drivers/hwtracing/coresight/coresight-cti.c @@ -494,12 +494,15 @@ static bool cti_add_sysfs_link(struct cti_drvdata *drvdata, return !link_err; } -static void cti_remove_sysfs_link(struct cti_trig_con *tc) +static void cti_remove_sysfs_link(struct cti_drvdata *drvdata, + struct cti_trig_con *tc) { struct coresight_sysfs_link link_info; + link_info.orig = drvdata->csdev; link_info.orig_name = tc->con_dev_name; link_info.target = tc->con_dev; + link_info.target_name = dev_name(&drvdata->csdev->dev); coresight_remove_sysfs_link(&link_info); } @@ -590,7 +593,7 @@ void cti_remove_assoc_from_csdev(struct coresight_device *csdev) ctidev = &ctidrv->ctidev; list_for_each_entry(tc, &ctidev->trig_cons, node) { if (tc->con_dev == csdev->ect_dev) { - cti_remove_sysfs_link(tc); + cti_remove_sysfs_link(ctidrv, tc); tc->con_dev = NULL; break; } @@ -634,7 +637,7 @@ static void cti_remove_conn_xrefs(struct cti_drvdata *drvdata) if (tc->con_dev) { coresight_set_assoc_ectdev_mutex(tc->con_dev, NULL); - cti_remove_sysfs_link(tc); + cti_remove_sysfs_link(drvdata, tc); tc->con_dev = NULL; } } -- 2.25.1