public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ext4: don't free an error pointer
@ 2017-06-30  7:56 Dan Carpenter
  2017-06-30 11:17 ` Tahsin Erdogan
  2017-07-04  1:37 ` Theodore Ts'o
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2017-06-30  7:56 UTC (permalink / raw)
  To: Theodore Ts'o, Andreas Dilger; +Cc: linux-ext4, kernel-janitors

"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;

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

end of thread, other threads:[~2017-07-04  1:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-30  7:56 [PATCH] ext4: don't free an error pointer Dan Carpenter
2017-06-30 11:17 ` Tahsin Erdogan
2017-07-04  1:37 ` Theodore Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox