Re: [PATCH 1/2] x86/mm/iommu/sva: Fix error code for LAM enabling failure due to SVA

From: Dmitry Vyukov
Date: Mon Apr 03 2023 - 09:56:03 EST


On Mon, 3 Apr 2023 at 13:10, Kirill A. Shutemov
<kirill.shutemov@xxxxxxxxxxxxxxx> wrote:
>
> Normally, LAM and SVA are mutually exclusive. LAM enabling will fail if
> SVA is already in use.
>
> Correct error code for the failure. EINTR is nonsensical there.
>
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx>
> Fixes: 23e5d9ec2bab ("x86/mm/iommu/sva: Make LAM and SVA mutually exclusive")
> Reported-by: Dmitry Vyukov <dvyukov@xxxxxxxxxx>

Reviewed-by: Dmitry Vyukov <dvyukov@xxxxxxxxxx>

> ---
> arch/x86/kernel/process_64.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
> index 74c7e84a94d8..c7dfd727c9ec 100644
> --- a/arch/x86/kernel/process_64.c
> +++ b/arch/x86/kernel/process_64.c
> @@ -760,7 +760,7 @@ static int prctl_enable_tagged_addr(struct mm_struct *mm, unsigned long nr_bits)
>
> if (mm_valid_pasid(mm) &&
> !test_bit(MM_CONTEXT_FORCE_TAGGED_SVA, &mm->context.flags))
> - return -EINTR;
> + return -EINVAL;
>
> if (mmap_write_lock_killable(mm))
> return -EINTR;
> --
> 2.39.2
>