Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ceb5edc4 authored by Jeff Mahoney's avatar Jeff Mahoney Committed by Linus Torvalds
Browse files

reiserfs: deal with NULL xattr root w/ xattrs disabled



This avoids an Oops in open_xa_root that can occur when deleting a file
with xattrs disabled.  It assumes that the xattr root will be there, and
that is not guaranteed.

Signed-off-by: default avatarJeff Mahoney <jeffm@suse.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 12abb35a
Loading
Loading
Loading
Loading
+0 −2
Original line number Original line Diff line number Diff line
@@ -448,13 +448,11 @@ int remove_save_link(struct inode *inode, int truncate)
static void reiserfs_kill_sb(struct super_block *s)
static void reiserfs_kill_sb(struct super_block *s)
{
{
	if (REISERFS_SB(s)) {
	if (REISERFS_SB(s)) {
#ifdef CONFIG_REISERFS_FS_XATTR
		if (REISERFS_SB(s)->xattr_root) {
		if (REISERFS_SB(s)->xattr_root) {
			d_invalidate(REISERFS_SB(s)->xattr_root);
			d_invalidate(REISERFS_SB(s)->xattr_root);
			dput(REISERFS_SB(s)->xattr_root);
			dput(REISERFS_SB(s)->xattr_root);
			REISERFS_SB(s)->xattr_root = NULL;
			REISERFS_SB(s)->xattr_root = NULL;
		}
		}
#endif
		if (REISERFS_SB(s)->priv_root) {
		if (REISERFS_SB(s)->priv_root) {
			d_invalidate(REISERFS_SB(s)->priv_root);
			d_invalidate(REISERFS_SB(s)->priv_root);
			dput(REISERFS_SB(s)->priv_root);
			dput(REISERFS_SB(s)->priv_root);
+3 −1
Original line number Original line Diff line number Diff line
@@ -123,7 +123,9 @@ static struct dentry *open_xa_root(struct super_block *sb, int flags)
	mutex_lock_nested(&privroot->d_inode->i_mutex, I_MUTEX_XATTR);
	mutex_lock_nested(&privroot->d_inode->i_mutex, I_MUTEX_XATTR);


	xaroot = dget(REISERFS_SB(sb)->xattr_root);
	xaroot = dget(REISERFS_SB(sb)->xattr_root);
	if (!xaroot->d_inode) {
	if (!xaroot)
		xaroot = ERR_PTR(-ENODATA);
	else if (!xaroot->d_inode) {
		int err = -ENODATA;
		int err = -ENODATA;
		if (xattr_may_create(flags))
		if (xattr_may_create(flags))
			err = xattr_mkdir(privroot->d_inode, xaroot, 0700);
			err = xattr_mkdir(privroot->d_inode, xaroot, 0700);