From: Akinobu Mita The return value of dentry_open() shoud be checked by IS_ERR(). Cc: Stephen Smalley Cc: James Morris Signed-off-by: Akinobu Mita Signed-off-by: Andrew Morton --- security/selinux/hooks.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff -puN security/selinux/hooks.c~selinux-fix-dentry_open-error-check security/selinux/hooks.c --- a/security/selinux/hooks.c~selinux-fix-dentry_open-error-check +++ a/security/selinux/hooks.c @@ -1757,7 +1757,8 @@ static inline void flush_unauthorized_fi get_file(devnull); } else { devnull = dentry_open(dget(selinux_null), mntget(selinuxfs_mount), O_RDWR); - if (!devnull) { + if (IS_ERR(devnull)) { + devnull = NULL; put_unused_fd(fd); fput(file); continue; _