[PATCH] ext3: Check return value of sb_getblk()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Check return value of sb_getblk() is NULL. unlikely is addded here
since it is called from a loop and we've been OK without the check
until now.

Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxx>
---
 fs/ext3/inode.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
index ef1c23a..a7ac778 100644
--- a/fs/ext3/inode.c
+++ b/fs/ext3/inode.c
@@ -655,6 +655,12 @@ static int ext3_alloc_branch(handle_t *handle, struct inode *inode,
 		 * parent to disk.
 		 */
 		bh = sb_getblk(inode->i_sb, new_blocks[n-1]);
+		if (unlikely(!bh)) {
+			n--;
+			err = -ENOMEM;
+			goto failed;
+		}
+
 		branch[n].bh = bh;
 		lock_buffer(bh);
 		BUFFER_TRACE(bh, "call get_create_access");
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux