The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Casey Schaufler <casey@schaufler-ca.com>
To: akpm@linux-foundation.org, torvalds@linux-foundation.org,
	"Ahmed S. Darwish" <darwish.07@gmail.com>,
	Miklos Szeredi <miklos@szeredi.hu>,
	lcapitulino@mandriva.com.br
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] Smack: fuse mount hang fix
Date: Mon, 02 Jun 2008 10:04:32 -0700	[thread overview]
Message-ID: <48442820.3080400@schaufler-ca.com> (raw)

From: Casey Schaufler <casey@schaufler-ca.com>

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>

---

security/smack/smack_lsm.c |   12 ++++++++++++
1 file changed, 12 insertions(+)

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
--- linux-2.6.25-g0530-base/security/smack/smack_lsm.c	2008-06-01 14:41:06.000000000 -0700
+++ linux-2.6.25-g0530/security/smack/smack_lsm.c	2008-06-01 20:29:57.000000000 -0700
@@ -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





             reply	other threads:[~2008-06-02 17:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-02 17:04 Casey Schaufler [this message]
2008-06-02 17:58 ` [PATCH] Smack: fuse mount hang fix Luiz Fernando N. Capitulino

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48442820.3080400@schaufler-ca.com \
    --to=casey@schaufler-ca.com \
    --cc=akpm@linux-foundation.org \
    --cc=darwish.07@gmail.com \
    --cc=lcapitulino@mandriva.com.br \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox