Commit e97dcb0eadbb821eccd549d4987b653cf61e2374

Authored by Casey Schaufler
Committed by Linus Torvalds
1 parent 246dd412d3

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>

Showing 1 changed file with 12 additions and 0 deletions Side-by-side Diff

security/smack/smack_lsm.c
... ... @@ -1881,6 +1881,18 @@
1881 1881 final = sbsp->smk_default;
1882 1882  
1883 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 + /*
1884 1896 * This is pretty hackish.
1885 1897 * Casey says that we shouldn't have to do
1886 1898 * file system specific code, but it does help