* [PATCH] arm64/ptrace: Fix an error handling path in sve_set_common()
@ 2023-07-17 17:55 Christophe JAILLET
2023-07-17 18:08 ` Mark Brown
2023-07-27 12:22 ` Will Deacon
0 siblings, 2 replies; 4+ messages in thread
From: Christophe JAILLET @ 2023-07-17 17:55 UTC (permalink / raw)
To: Oleg Nesterov, Catalin Marinas, Will Deacon, Mark Brown
Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-arm-kernel
All error handling paths go to 'out', except this one. Be consistent and
also branch to 'out' here.
Fixes: e12310a0d30f ("arm64/sme: Implement ptrace support for streaming mode SVE registers")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
/!\ Speculative /!\
This patch is based on analysis of the surrounding code and should be
reviewed with care !
If the patch is wrong, maybe a comment in the code could explain why.
/!\ Speculative /!\
---
arch/arm64/kernel/ptrace.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c
index d7f4f0d1ae12..9bc23f1b499e 100644
--- a/arch/arm64/kernel/ptrace.c
+++ b/arch/arm64/kernel/ptrace.c
@@ -884,7 +884,8 @@ static int sve_set_common(struct task_struct *target,
break;
default:
WARN_ON_ONCE(1);
- return -EINVAL;
+ ret = -EINVAL;
+ goto out;
}
/*
--
2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] arm64/ptrace: Fix an error handling path in sve_set_common()
2023-07-17 17:55 [PATCH] arm64/ptrace: Fix an error handling path in sve_set_common() Christophe JAILLET
@ 2023-07-17 18:08 ` Mark Brown
2023-07-18 6:28 ` Anshuman Khandual
2023-07-27 12:22 ` Will Deacon
1 sibling, 1 reply; 4+ messages in thread
From: Mark Brown @ 2023-07-17 18:08 UTC (permalink / raw)
To: Christophe JAILLET
Cc: Oleg Nesterov, Catalin Marinas, Will Deacon, linux-kernel,
kernel-janitors, linux-arm-kernel
[-- Attachment #1: Type: text/plain, Size: 721 bytes --]
On Mon, Jul 17, 2023 at 07:55:05PM +0200, Christophe JAILLET wrote:
> All error handling paths go to 'out', except this one. Be consistent and
> also branch to 'out' here.
This looks like a reasonable cleanup.
Reviewed-by: Mark Brown <broonie@kernel.org>
> Fixes: e12310a0d30f ("arm64/sme: Implement ptrace support for streaming mode SVE registers")
> default:
> WARN_ON_ONCE(1);
> - return -EINVAL;
> + ret = -EINVAL;
> + goto out;
> }
It's not exactly a fix though (probably not worth backporting for
example, which tends to get keyed off the fixes tag) since something's
incredibly confused if this code path ever gets executed, we're setting
an unknown SVE vector type hence the WARN_ON() there.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] arm64/ptrace: Fix an error handling path in sve_set_common()
2023-07-17 18:08 ` Mark Brown
@ 2023-07-18 6:28 ` Anshuman Khandual
0 siblings, 0 replies; 4+ messages in thread
From: Anshuman Khandual @ 2023-07-18 6:28 UTC (permalink / raw)
To: Mark Brown, Christophe JAILLET
Cc: Oleg Nesterov, Catalin Marinas, Will Deacon, linux-kernel,
kernel-janitors, linux-arm-kernel
On 7/17/23 23:38, Mark Brown wrote:
> On Mon, Jul 17, 2023 at 07:55:05PM +0200, Christophe JAILLET wrote:
>> All error handling paths go to 'out', except this one. Be consistent and
>> also branch to 'out' here.
>
> This looks like a reasonable cleanup.
>
> Reviewed-by: Mark Brown <broonie@kernel.org>
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
>
>> Fixes: e12310a0d30f ("arm64/sme: Implement ptrace support for streaming mode SVE registers")
>
>> default:
>> WARN_ON_ONCE(1);
>> - return -EINVAL;
>> + ret = -EINVAL;
>> + goto out;
>> }
>
> It's not exactly a fix though (probably not worth backporting for
+1
> example, which tends to get keyed off the fixes tag) since something's
> incredibly confused if this code path ever gets executed, we're setting
> an unknown SVE vector type hence the WARN_ON() there.
Agreed.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] arm64/ptrace: Fix an error handling path in sve_set_common()
2023-07-17 17:55 [PATCH] arm64/ptrace: Fix an error handling path in sve_set_common() Christophe JAILLET
2023-07-17 18:08 ` Mark Brown
@ 2023-07-27 12:22 ` Will Deacon
1 sibling, 0 replies; 4+ messages in thread
From: Will Deacon @ 2023-07-27 12:22 UTC (permalink / raw)
To: Oleg Nesterov, Christophe JAILLET, Catalin Marinas, Mark Brown
Cc: kernel-team, Will Deacon, linux-kernel, linux-arm-kernel,
kernel-janitors
On Mon, 17 Jul 2023 19:55:05 +0200, Christophe JAILLET wrote:
> All error handling paths go to 'out', except this one. Be consistent and
> also branch to 'out' here.
>
>
Applied to arm64 (for-next/misc), thanks!
[1/1] arm64/ptrace: Fix an error handling path in sve_set_common()
https://git.kernel.org/arm64/c/5f69ca4229c7
Cheers,
--
Will
https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-07-27 12:23 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-17 17:55 [PATCH] arm64/ptrace: Fix an error handling path in sve_set_common() Christophe JAILLET
2023-07-17 18:08 ` Mark Brown
2023-07-18 6:28 ` Anshuman Khandual
2023-07-27 12:22 ` Will Deacon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®