From: Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>
To: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: mathieu.poirier@linaro.org, alexander.shishkin@linux.intel.com,
linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
swboyd@chromium.org, leo.yan@linaro.org,
linux-arm-kernel@lists.infradead.org, mike.leach@linaro.org
Subject: Re: [RFC PATCH] coresight: dynamic-replicator: Fix handling of multiple connections
Date: Thu, 09 Apr 2020 15:04:27 +0530 [thread overview]
Message-ID: <fd20605ba5b98b5c1120e24f0f330166@codeaurora.org> (raw)
In-Reply-To: <671892c3-b90d-73f0-4706-b74b40002260@arm.com>
Hi Suzuki,
On 2020-04-09 14:47, Suzuki K Poulose wrote:
> Hi Sai,
>
>
> Thanks for the quick testing ! Please see below for the
> tmc_etr probe failure.
>
> On 04/09/2020 08:51 AM, Sai Prakash Ranjan wrote:
>> Hi Suzuki,
>>
>> On 2020-04-09 04:13, Suzuki K Poulose wrote:
>>> On Tue, Apr 07, 2020 at 08:48:54PM +0530, Sai Prakash Ranjan wrote:
>>>
>>> Please find the untested patch below.
>>>
>>> ---8>---
>>>
>>> [untested] coresight: Fix support for sparse port numbers
>>>
>>> On some systems the firmware may not describe all the ports
>>> connected to a component (e.g, for security reasons). This
>>> could be especially problematic for "funnels" where we could
>>> end up in modifying memory beyond the allocated space for
>>> refcounts.
>>>
>>> e.g, for a funnel with input ports listed 0, 3, 5, nr_inport = 3.
>>> However the we could access refcnts[5] while checking for
>>> references.
>>>
>>> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
>>> ---
>>> .../hwtracing/coresight/coresight-platform.c | 74
>>> ++++++++++++-------
>>> drivers/hwtracing/coresight/coresight.c | 8 +-
>>> 2 files changed, 56 insertions(+), 26 deletions(-)
>>>
>>> diff --git a/drivers/hwtracing/coresight/coresight-platform.c
>>> b/drivers/hwtracing/coresight/coresight-platform.c
>>> index 3c5bee429105..1c610d6e944b 100644
>>> --- a/drivers/hwtracing/coresight/coresight-platform.c
>>> +++ b/drivers/hwtracing/coresight/coresight-platform.c
>>> @@ -67,6 +67,7 @@ static void of_coresight_get_ports_legacy(const
>
> [...]
>
>>> @@ -684,8 +702,13 @@ static int acpi_coresight_parse_graph(struct
>>> acpi_device *adev,
>>> return rc;
>>>
>>> /* Copy the connection information to the final location */
>>> - for (i = 0; i < pdata->nr_outport; i++)
>>> - pdata->conns[i] = conns[i];
>>> + for (i = 0; conns + i < ptr; i++) {
>>> + int port = conns[i].outport;
>>> +
>>> + /* Duplicate output port */
>>> + WARN_ON(pdata->conns[port].child_fwnode);
>>> + pdata->conns[port] = conns[i];
>>> + }
>>>
>>> devm_kfree(&adev->dev, conns);
>>> return 0;
>>> @@ -787,6 +810,7 @@ coresight_get_platform_data(struct device *dev)
>>> goto error;
>>>
>>> pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
>>> + pdata->nr_outport = pdata->nr_inport = -1;
>
>
> Please could you remove this hunk and test it ? I forgot to update the
> commit before I sent this over.
>
I don't see the ETR probe failure and the KASAN warning anymore with
this change.
Tested-by: Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>
Thanks,
Sai
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a
member
of Code Aurora Forum, hosted by The Linux Foundation
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2020-04-09 9:34 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-05 10:28 [RFC PATCH] coresight: dynamic-replicator: Fix handling of multiple connections Sai Prakash Ranjan
2020-04-06 10:55 ` Mike Leach
2020-04-07 9:46 ` Sai Prakash Ranjan
2020-04-07 10:24 ` Suzuki K Poulose
2020-04-07 11:29 ` Sai Prakash Ranjan
2020-04-07 13:08 ` Suzuki K Poulose
2020-04-07 13:56 ` Sai Prakash Ranjan
2020-04-07 14:53 ` Suzuki K Poulose
2020-04-07 15:18 ` Sai Prakash Ranjan
2020-04-08 22:43 ` Suzuki K Poulose
2020-04-09 7:16 ` Stephen Boyd
2020-04-09 7:51 ` Sai Prakash Ranjan
2020-04-09 9:17 ` Suzuki K Poulose
2020-04-09 9:34 ` Sai Prakash Ranjan [this message]
2020-04-23 12:21 ` Sai Prakash Ranjan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fd20605ba5b98b5c1120e24f0f330166@codeaurora.org \
--to=saiprakash.ranjan@codeaurora.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=leo.yan@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.poirier@linaro.org \
--cc=mike.leach@linaro.org \
--cc=suzuki.poulose@arm.com \
--cc=swboyd@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).