cxl: don't manipulate the mm.mm_users field directly
authorLaurent Dufour <ldufour@linux.ibm.com>
Wed, 10 Mar 2021 17:44:05 +0000 (18:44 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 Mar 2021 07:26:30 +0000 (08:26 +0100)
It is better to rely on the API provided by the MM layer instead of
directly manipulating the mm_users field.

Acked-by: Frederic Barrat <fbarrat@linux.ibm.com>
Acked-by: Andrew Donnellan <ajd@linux.ibm.com>
Signed-off-by: Laurent Dufour <ldufour@linux.ibm.com>
Link: https://lore.kernel.org/r/20210310174405.51044-1-ldufour@linux.ibm.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/cxl/fault.c

index 01153b74334a1b394a1a9e5dba7fffed5921807d..60c829113299bd771580030b1d616cf272d1daf3 100644 (file)
@@ -200,7 +200,7 @@ static struct mm_struct *get_mem_context(struct cxl_context *ctx)
        if (ctx->mm == NULL)
                return NULL;
 
-       if (!atomic_inc_not_zero(&ctx->mm->mm_users))
+       if (!mmget_not_zero(ctx->mm))
                return NULL;
 
        return ctx->mm;