--- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c @@ -3414,6 +3414,10 @@ static int selinux_inode_setsecurity(str static int selinux_inode_listsecurity(struct inode *inode, char *buffer, size_t buffer_size) { const int len = sizeof(XATTR_NAME_SELINUX); + + if (!selinux_initialized(&selinux_state)) + return 0; + if (buffer && len <= buffer_size) memcpy(buffer, XATTR_NAME_SELINUX, len); return len;