linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Curt Wohlgemuth <curtw@google.com>
To: ext4 development <linux-ext4@vger.kernel.org>
Subject: [PATCH] ext4: Fix buffer head ref leaks after calls to ext4_get_inode_loc()
Date: Mon, 22 Mar 2010 08:46:42 -0700	[thread overview]
Message-ID: <6601abe91003220846x46a2a8d5u2769c0563910c7d3@mail.gmail.com> (raw)

Fix buffer head reference leaks in ext4_write_inode() and
ext4_xattr_fiemap().

Signed-off-by: Curt Wohlgemuth <curtw@google.com>
---

ext4_get_inode_loc() returns with a reference to the iloc->bh; the two call
sites below do not release this reference.


diff -uprN orig/fs/ext4/extents.c new/fs/ext4/extents.c
--- orig/fs/ext4/extents.c	2010-03-22 08:16:57.000000000 -0700
+++ new/fs/ext4/extents.c	2010-03-22 08:35:40.000000000 -0700
@@ -3879,6 +3879,7 @@ static int ext4_xattr_fiemap(struct inod
 		physical += offset;
 		length = EXT4_SB(inode->i_sb)->s_inode_size - offset;
 		flags |= FIEMAP_EXTENT_DATA_INLINE;
+		brelse(iloc.bh);
 	} else { /* external block */
 		physical = EXT4_I(inode)->i_file_acl << blockbits;
 		length = inode->i_sb->s_blocksize;
diff -uprN orig/fs/ext4/inode.c new/fs/ext4/inode.c
--- orig/fs/ext4/inode.c	2010-03-22 08:16:57.000000000 -0700
+++ new/fs/ext4/inode.c	2010-03-22 08:36:18.000000000 -0700
@@ -5385,6 +5385,7 @@ int ext4_write_inode(struct inode *inode
 				   (unsigned long long)iloc.bh->b_blocknr);
 			err = -EIO;
 		}
+		brelse(iloc.bh);
 	}
 	return err;
 }

             reply	other threads:[~2010-03-22 15:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-22 15:46 Curt Wohlgemuth [this message]
2010-04-03 21:44 ` [PATCH] ext4: Fix buffer head ref leaks after calls to ext4_get_inode_loc() tytso

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=6601abe91003220846x46a2a8d5u2769c0563910c7d3@mail.gmail.com \
    --to=curtw@google.com \
    --cc=linux-ext4@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).