All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Robin Murphy <robin.murphy@arm.com>
To: Tuan Phan <tuanphan@os.amperecomputing.com>
Cc: Will Deacon <will@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] perf/arm-cmn: Fix invalid pointer when access dtc object sharing the same IRQ number
Date: Thu, 17 Jun 2021 18:48:06 +0100	[thread overview]
Message-ID: <b3f1126d-2906-cf36-4d3d-eb86552fa50b@arm.com> (raw)
In-Reply-To: <1623946129-3290-1-git-send-email-tuanphan@os.amperecomputing.com>

On 2021-06-17 17:08, Tuan Phan wrote:
> When multiple dtcs share the same IRQ number, the irq_friend which
> used to refer to dtc object gets calculated incorrect which leads
> to invalid pointer.

Oops, indeed this is supposed to be a forward offset *from* the previous 
match *to* the current dtc. It's almost as if I never managed to test 
it... :)

Reviewed-by: Robin Murphy <robin.murphy@arm.com>

> Fixes: 0ba64770a2f2 ("perf: Add Arm CMN-600 PMU driver")
> 
> Signed-off-by: Tuan Phan <tuanphan@os.amperecomputing.com>
> ---
>   drivers/perf/arm-cmn.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c
> index 56a5c35..49016f2 100644
> --- a/drivers/perf/arm-cmn.c
> +++ b/drivers/perf/arm-cmn.c
> @@ -1212,7 +1212,7 @@ static int arm_cmn_init_irqs(struct arm_cmn *cmn)
>   		irq = cmn->dtc[i].irq;
>   		for (j = i; j--; ) {
>   			if (cmn->dtc[j].irq == irq) {
> -				cmn->dtc[j].irq_friend = j - i;
> +				cmn->dtc[j].irq_friend = i - j;
>   				goto next;
>   			}
>   		}
> 

WARNING: multiple messages have this Message-ID (diff)
From: Robin Murphy <robin.murphy@arm.com>
To: Tuan Phan <tuanphan@os.amperecomputing.com>
Cc: Will Deacon <will@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] perf/arm-cmn: Fix invalid pointer when access dtc object sharing the same IRQ number
Date: Thu, 17 Jun 2021 18:48:06 +0100	[thread overview]
Message-ID: <b3f1126d-2906-cf36-4d3d-eb86552fa50b@arm.com> (raw)
In-Reply-To: <1623946129-3290-1-git-send-email-tuanphan@os.amperecomputing.com>

On 2021-06-17 17:08, Tuan Phan wrote:
> When multiple dtcs share the same IRQ number, the irq_friend which
> used to refer to dtc object gets calculated incorrect which leads
> to invalid pointer.

Oops, indeed this is supposed to be a forward offset *from* the previous 
match *to* the current dtc. It's almost as if I never managed to test 
it... :)

Reviewed-by: Robin Murphy <robin.murphy@arm.com>

> Fixes: 0ba64770a2f2 ("perf: Add Arm CMN-600 PMU driver")
> 
> Signed-off-by: Tuan Phan <tuanphan@os.amperecomputing.com>
> ---
>   drivers/perf/arm-cmn.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c
> index 56a5c35..49016f2 100644
> --- a/drivers/perf/arm-cmn.c
> +++ b/drivers/perf/arm-cmn.c
> @@ -1212,7 +1212,7 @@ static int arm_cmn_init_irqs(struct arm_cmn *cmn)
>   		irq = cmn->dtc[i].irq;
>   		for (j = i; j--; ) {
>   			if (cmn->dtc[j].irq == irq) {
> -				cmn->dtc[j].irq_friend = j - i;
> +				cmn->dtc[j].irq_friend = i - j;
>   				goto next;
>   			}
>   		}
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-06-17 17:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-17 16:08 [PATCH] perf/arm-cmn: Fix invalid pointer when access dtc object sharing the same IRQ number Tuan Phan
2021-06-17 16:08 ` Tuan Phan
2021-06-17 17:48 ` Robin Murphy [this message]
2021-06-17 17:48   ` Robin Murphy
2021-06-17 22:38 ` Will Deacon
2021-06-17 22:38   ` Will Deacon

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=b3f1126d-2906-cf36-4d3d-eb86552fa50b@arm.com \
    --to=robin.murphy@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=tuanphan@os.amperecomputing.com \
    --cc=will@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.