habanalabs: remove FOLL_FORCE usage
authorDavid Hildenbrand <david@redhat.com>
Wed, 16 Nov 2022 10:26:58 +0000 (11:26 +0100)
committerAndrew Morton <akpm@linux-foundation.org>
Wed, 30 Nov 2022 23:59:00 +0000 (15:59 -0800)
FOLL_FORCE is really only for ptrace access. As we unpin the pinned pages
using unpin_user_pages_dirty_lock(true), the assumption is that all these
pages are writable.

FOLL_FORCE in this case seems to be due to copy-and-past from other
drivers. Let's just remove it.

Link: https://lkml.kernel.org/r/20221116102659.70287-20-david@redhat.com
Signed-off-by: David Hildenbrand <david@redhat.com>
Acked-by: Oded Gabbay <ogabbay@kernel.org>
Cc: Oded Gabbay <ogabbay@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
drivers/misc/habanalabs/common/memory.c

index ef28f3b..e35cca9 100644 (file)
@@ -2312,8 +2312,7 @@ static int get_user_memory(struct hl_device *hdev, u64 addr, u64 size,
        if (!userptr->pages)
                return -ENOMEM;
 
-       rc = pin_user_pages_fast(start, npages,
-                                FOLL_FORCE | FOLL_WRITE | FOLL_LONGTERM,
+       rc = pin_user_pages_fast(start, npages, FOLL_WRITE | FOLL_LONGTERM,
                                 userptr->pages);
 
        if (rc != npages) {