From: Dan Williams Date: Thu, 22 Feb 2018 01:08:01 +0000 (-0800) Subject: dax: fix vma_is_fsdax() helper X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=230f5a8969d8345fc9bbe3683f068246cf1be4b8;p=linux.git dax: fix vma_is_fsdax() helper 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: Reported-by: Gerd Rausch Acked-by: Jane Chu Reported-by: Haozhong Zhang Reviewed-by: Jan Kara Signed-off-by: Dan Williams --- diff --git a/include/linux/fs.h b/include/linux/fs.h index 2a815560fda0e..79c4139853057 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -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; }