All of lore.kernel.org
 help / color / mirror / Atom feed
* 2.6.11-rc2/ext3 quota allocation bug on error path ...
@ 2005-01-22 15:50 Herbert Poetzl
  2005-01-24 10:14 ` Jan Kara
  2005-01-26 18:32 ` Andreas Gruenbacher
  0 siblings, 2 replies; 6+ messages in thread
From: Herbert Poetzl @ 2005-01-22 15:50 UTC (permalink / raw)
  To: linux-kernel; +Cc: Jan Kara, Andrew Morton


looking at ext3_xattr_block_set() [fs/ext3/xattr.c] ...
I see that 

                                error = -EDQUOT;
                                if (DQUOT_ALLOC_BLOCK(inode, 1))
                                        goto cleanup;

allocates a quota block, but right after that several
error echecks happen ...

                                if (error)
                                        goto cleanup;

and I don't see any DQUOT_FREE_BLOCK() in the errorpath

cleanup:
        if (ce)
                mb_cache_entry_release(ce);
        brelse(new_bh); 
        if (!(bs->bh && s->base == bs->bh->b_data))
                kfree(s->base);

        return error;

I'd suggest the attached fix (agains 2.6.11-rc2), comments?

best,
Herbert


--- ./fs/ext3/xattr.c.orig	2005-01-22 15:07:50 +0100
+++ ./fs/ext3/xattr.c		2005-01-22 16:45:09 +0100
@@ -773,7 +773,7 @@ inserted:
 				error = ext3_journal_get_write_access(handle,
 								      new_bh);
 				if (error)
-					goto cleanup;
+					goto cleanup_dquot;
 				lock_buffer(new_bh);
 				BHDR(new_bh)->h_refcount = cpu_to_le32(1 +
 					le32_to_cpu(BHDR(new_bh)->h_refcount));
@@ -783,7 +783,7 @@ inserted:
 				error = ext3_journal_dirty_metadata(handle,
 								    new_bh);
 				if (error)
-					goto cleanup;
+					goto cleanup_dquot;
 			}
 			mb_cache_entry_release(ce);
 			ce = NULL;
@@ -844,6 +844,10 @@ cleanup:
 
 	return error;
 
+cleanup_dquot:
+	DQUOT_FREE_BLOCK(inode, 1);
+	goto cleanup;
+
 bad_block:
 	ext3_error(inode->i_sb, __FUNCTION__,
 		   "inode %ld: bad block %d", inode->i_ino,


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-01-27 10:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-22 15:50 2.6.11-rc2/ext3 quota allocation bug on error path Herbert Poetzl
2005-01-24 10:14 ` Jan Kara
2005-01-26 18:32 ` Andreas Gruenbacher
2005-01-26 19:24   ` Andrew Morton
2005-01-26 22:41     ` Herbert Poetzl
2005-01-27 10:39       ` Jan Kara

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.