Skip to content

Commit d105d69

Browse files
brooniewilldeacon
authored andcommitted
arm64/ptrace: Don't clear calling process' TIF_SME on OOM
If allocating memory for the target SVE state in za_set() fails we clear TIF_SME for the ptracing task which is obviously not correct. If we are here we know that the target task already had neither TIF_SVE nor TIF_SME set since we only need to allocate if either the target had not used either SVE or SME and had no need to allocate state before or we just changed the vector length with vec_set_vector_length() which clears TIF_ for us on allocation failure so just remove the clear entirely. Reported-by: Wang ShaoBo <[email protected]> Signed-off-by: Mark Brown <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent c0a454b commit d105d69

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

arch/arm64/kernel/ptrace.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,7 +1084,6 @@ static int za_set(struct task_struct *target,
10841084
if (!target->thread.sve_state) {
10851085
sve_alloc(target, false);
10861086
if (!target->thread.sve_state) {
1087-
clear_thread_flag(TIF_SME);
10881087
ret = -ENOMEM;
10891088
goto out;
10901089
}
@@ -1094,7 +1093,6 @@ static int za_set(struct task_struct *target,
10941093
sme_alloc(target);
10951094
if (!target->thread.za_state) {
10961095
ret = -ENOMEM;
1097-
clear_tsk_thread_flag(target, TIF_SME);
10981096
goto out;
10991097
}
11001098

0 commit comments

Comments
 (0)