]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
dax: fix vma_is_fsdax() helper
authorDan Williams <dan.j.williams@intel.com>
Thu, 22 Feb 2018 01:08:01 +0000 (17:08 -0800)
committerSeth Forshee <seth.forshee@canonical.com>
Thu, 15 Mar 2018 13:27:44 +0000 (08:27 -0500)
BugLink: http://bugs.launchpad.net/bugs/1755179
commit 230f5a8969d8345fc9bbe3683f068246cf1be4b8 upstream.

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: <stable@vger.kernel.org>
Reported-by: Gerd Rausch <gerd.rausch@oracle.com>
Acked-by: Jane Chu <jane.chu@oracle.com>
Reported-by: Haozhong Zhang <haozhong.zhang@intel.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
include/linux/fs.h

index 2bb5892c12eabaa5505edf1292df461bffc39720..85a35388ee08483359057888f0f13bc4f1e1019a 100644 (file)
@@ -3219,7 +3219,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;
 }