Skip to contentSkip to conversation

Smack: fuse mount hang fix

PATCH In review Casey Schaufler 2 participants 2 messages Jun 2, 2008

Subsystems (2)
lore
Share & tools
lore

Casey Schaufler

author maintainer
#0 lore raw

PATCH 1/1 Smack: fuse mount hang fix

From: Casey Schaufler <[email protected]>

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.

---

security/smack/smack_lsm.c | 12 ++++++++++++

1 file changed, 12 insertions(+)
security/smack/smack_lsm.c +0 -0
diff -uprN -X linux-2.6.25-g0530-base/Documentation/dontdiff linux-2.6.25-g0530-base/security/smack/smack_lsm.c linux-2.6.25-g0530/security/smack/smack_lsm.c
@@ -1881,6 +1881,18 @@ static void smack_d_instantiate(struct d
	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
* file system specific code, but it does help

Tested-by on v1 1/1
#1 lore raw

Em Mon, 02 Jun 2008 10:04:32 -0700
Casey Schaufler <[email protected]> escreveu:

| From: Casey Schaufler <[email protected]>
| 
| 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 <[email protected]>

Fixed the problem for me, thank very much.

Signature · 1 line
Luiz Fernando N. Capitulino