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 <bobo.shaobowang@huawei.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20220902132802.39682-1-broonie@kernel.org
Signed-off-by: Will Deacon <will@kernel.org>

authored by Mark Brown and committed by Will Deacon d105d692 c0a454b9

Changed files
-2
arch
arm64
kernel
-2
arch/arm64/kernel/ptrace.c
··· 1084 1084 if (!target->thread.sve_state) { 1085 1085 sve_alloc(target, false); 1086 1086 if (!target->thread.sve_state) { 1087 - clear_thread_flag(TIF_SME); 1088 1087 ret = -ENOMEM; 1089 1088 goto out; 1090 1089 } ··· 1093 1094 sme_alloc(target); 1094 1095 if (!target->thread.za_state) { 1095 1096 ret = -ENOMEM; 1096 - clear_tsk_thread_flag(target, TIF_SME); 1097 1097 goto out; 1098 1098 } 1099 1099