All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Mahoney <jeffm@suse.com>
To: Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	ReiserFS Development List <reiserfs-devel@vger.kernel.org>
Subject: [patch 2/4] [PATCH] reiserfs: deal with NULL xattr root w/ xattrs disabled
Date: Sun, 17 May 2009 01:02:02 -0400	[thread overview]
Message-ID: <20090517050331.993181046@suse.com> (raw)
In-Reply-To: 20090517050200.786752018@suse.com

[-- Attachment #1: patches.fixes/reiserfs-xattr-root-fixup --]
[-- Type: text/plain, Size: 1302 bytes --]

 This patch 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: Jeff Mahoney <jeffm@suse.com>
---
 fs/reiserfs/super.c |    2 --
 fs/reiserfs/xattr.c |    4 +++-
 2 files changed, 3 insertions(+), 3 deletions(-)

--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -448,13 +448,11 @@ int remove_save_link(struct inode *inode
 static void reiserfs_kill_sb(struct super_block *s)
 {
 	if (REISERFS_SB(s)) {
-#ifdef CONFIG_REISERFS_FS_XATTR
 		if (REISERFS_SB(s)->xattr_root) {
 			d_invalidate(REISERFS_SB(s)->xattr_root);
 			dput(REISERFS_SB(s)->xattr_root);
 			REISERFS_SB(s)->xattr_root = NULL;
 		}
-#endif
 		if (REISERFS_SB(s)->priv_root) {
 			d_invalidate(REISERFS_SB(s)->priv_root);
 			dput(REISERFS_SB(s)->priv_root);
--- a/fs/reiserfs/xattr.c
+++ b/fs/reiserfs/xattr.c
@@ -123,7 +123,9 @@ static struct dentry *open_xa_root(struc
 	mutex_lock_nested(&privroot->d_inode->i_mutex, I_MUTEX_XATTR);
 
 	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;
 		if (xattr_may_create(flags))
 			err = xattr_mkdir(privroot->d_inode, xaroot, 0700);


  parent reply	other threads:[~2009-05-17  5:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-17  5:02 [patch 0/4] Reiserfs fixes Jeff Mahoney
2009-05-17  5:02 ` [patch 1/4] reiserfs: clean up ifdefs Jeff Mahoney
2009-05-17  5:02 ` Jeff Mahoney [this message]
2009-05-17  5:02 ` [patch 3/4] reiserfs: fixup perms when xattrs are disabled Jeff Mahoney
2009-05-17 11:50   ` Stefan Richter
2009-05-17 13:59     ` Jeff Mahoney
2009-05-17  5:02 ` [patch 4/4] reiserfs: allow exposing privroot w/ xattrs enabled Jeff Mahoney
2009-05-17 17:10   ` Linus Torvalds
2009-05-18 17:28     ` Linus Torvalds
2009-05-18 17:35       ` Jeff Mahoney
2009-05-18 17:42         ` Linus Torvalds
  -- strict thread matches above, loose matches on Subject: below --
2009-05-10 20:05 [patch 0/4] reiserfs xattr fixups Jeff Mahoney
2009-05-10 20:05 ` [patch 2/4] [PATCH] reiserfs: deal with NULL xattr root w/ xattrs disabled Jeff Mahoney

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=20090517050331.993181046@suse.com \
    --to=jeffm@suse.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=reiserfs-devel@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.