Smack: fuse mount hang fix

The d_instantiate hook for Smack can hang on the root inode of a
filesystem if the file system code has not really done all the set-up.
Fuse is known to encounter this problem.

This change detects an attempt to instantiate a root inode and addresses
it early in the processing, before any attempt is made to do something
that might hang.

Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
Tested-by: Luiz Fernando N. Capitulino <lcapitulino@mandriva.com.br>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by Casey Schaufler and committed by Linus Torvalds e97dcb0e 246dd412

+12
+12
security/smack/smack_lsm.c
··· 1881 final = sbsp->smk_default; 1882 1883 /* 1884 * This is pretty hackish. 1885 * Casey says that we shouldn't have to do 1886 * file system specific code, but it does help
··· 1881 final = sbsp->smk_default; 1882 1883 /* 1884 + * If this is the root inode the superblock 1885 + * may be in the process of initialization. 1886 + * If that is the case use the root value out 1887 + * of the superblock. 1888 + */ 1889 + if (opt_dentry->d_parent == opt_dentry) { 1890 + isp->smk_inode = sbsp->smk_root; 1891 + isp->smk_flags |= SMK_INODE_INSTANT; 1892 + goto unlockandout; 1893 + } 1894 + 1895 + /* 1896 * This is pretty hackish. 1897 * Casey says that we shouldn't have to do 1898 * file system specific code, but it does help