Skip to content

Commit

Permalink
Smack: fuse mount hang fix
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Casey Schaufler authored and Linus Torvalds committed Jun 4, 2008
1 parent 246dd41 commit e97dcb0
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions security/smack/smack_lsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1880,6 +1880,18 @@ static void smack_d_instantiate(struct dentry *opt_dentry, struct inode *inode)
*/
final = sbsp->smk_default;

/*
* If this is the root inode the superblock
* may be in the process of initialization.
* If that is the case use the root value out
* of the superblock.
*/
if (opt_dentry->d_parent == opt_dentry) {
isp->smk_inode = sbsp->smk_root;
isp->smk_flags |= SMK_INODE_INSTANT;
goto unlockandout;
}

/*
* This is pretty hackish.
* Casey says that we shouldn't have to do
Expand Down

0 comments on commit e97dcb0

Please sign in to comment.