dax: fix vma_is_fsdax() helper
authorDan Williams <[email protected]>
Thu, 22 Feb 2018 01:08:01 +0000 (17:08 -0800)
committerDan Williams <[email protected]>
Mon, 26 Feb 2018 20:32:42 +0000 (12:32 -0800)
Gerd reports that ->i_mode may contain other bits besides S_IFCHR. Use
S_ISCHR() instead. Otherwise, get_user_pages_longterm() may fail on
device-dax instances when those are meant to be explicitly allowed.

Fixes: 2bb6d2837083 ("mm: introduce get_user_pages_longterm")
Cc: <[email protected]>
Reported-by: Gerd Rausch <[email protected]>
Acked-by: Jane Chu <[email protected]>
Reported-by: Haozhong Zhang <[email protected]>
Reviewed-by: Jan Kara <[email protected]>
Signed-off-by: Dan Williams <[email protected]>
include/linux/fs.h

index 2a815560fda0e162c5c27da8249b9f3921328c21..79c4139853057ed8de863a074e1a34a13bfa9b4f 100644 (file)
@@ -3198,7 +3198,7 @@ static inline bool vma_is_fsdax(struct vm_area_struct *vma)
        if (!vma_is_dax(vma))
                return false;
        inode = file_inode(vma->vm_file);
-       if (inode->i_mode == S_IFCHR)
+       if (S_ISCHR(inode->i_mode))
                return false; /* device-dax */
        return true;
 }