public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: "Theodore Ts'o" <tytso@mit.edu>,
	Andreas Dilger <adilger.kernel@dilger.ca>
Cc: linux-ext4@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH] ext4: don't free an error pointer
Date: Fri, 30 Jun 2017 10:56:53 +0300	[thread overview]
Message-ID: <20170630075652.gsvvzybinoee2biw@mwanda> (raw)

"goto out;" calls brelse(bh); which will oops on this this path where
"bh" is an error pointer.

Fixes: 2851a40a5d71 ("ext4: xattr-in-inode support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
Oops.  I wrote a bug report and a patch for this...  Probably we only
need the patch.


diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
index ce12c3fb7e59..f7d6845e147b 100644
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -1305,10 +1305,8 @@ static int ext4_xattr_inode_write(handle_t *handle, struct inode *ea_inode,
 		csize = (bufsize - wsize) > blocksize ? blocksize :
 								bufsize - wsize;
 		bh = ext4_getblk(handle, ea_inode, block, 0);
-		if (IS_ERR(bh)) {
-			ret = PTR_ERR(bh);
-			goto out;
-		}
+		if (IS_ERR(bh))
+			return PTR_ERR(bh);
 		ret = ext4_journal_get_write_access(handle, bh);
 		if (ret)
 			goto out;

             reply	other threads:[~2017-06-30  7:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-30  7:56 Dan Carpenter [this message]
2017-06-30 11:17 ` [PATCH] ext4: don't free an error pointer Tahsin Erdogan
2017-07-04  1:37 ` Theodore Ts'o

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=20170630075652.gsvvzybinoee2biw@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=adilger.kernel@dilger.ca \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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