[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20111207020446.GU2203@ZenIV.linux.org.uk>
Date: Wed, 7 Dec 2011 02:04:46 +0000
From: Al Viro <viro@...IV.linux.org.uk>
To: Casey Schaufler <casey@...aufler-ca.com>
Cc: Chris Mason <chris.mason@...cle.com>,
linux-btrfs <linux-btrfs@...r.kernel.org>,
LSM <linux-security-module@...r.kernel.org>,
LKLM <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] BTRFS: Establish i_ops before calling d_instantiate
On Tue, Dec 06, 2011 at 04:39:50PM -0800, Casey Schaufler wrote:
> From: Casey Schaufler <casey@...aufler-ca.com>
>
> The Smack LSM hook for security_d_instantiate checks
> the inode's i_op->getxattr value to determine if the
[snip]
> + inode->i_op = &btrfs_special_inode_operations;
> +
> err = btrfs_add_nondir(trans, dir, dentry, inode, 0, index);
> if (err)
> drop_inode = 1;
> else {
> - inode->i_op = &btrfs_special_inode_operations;
> init_special_inode(inode, inode->i_mode, rdev);
> btrfs_update_inode(trans, root, inode);
To hell with LSM, there are much stronger reasons why d_instantiate() on
a half-baked inode is wrong. As soon as you've done it somebody can
come and look that dentry up.
IOW, the bug is real, but this patch is not enough - in particular, ->create()
part is simply wrong. We need to set ->a_ops before some joker comes and
tries to open it, at the very least...
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists