[Debian-ha-commits] [ocfs2-tools] 17/58: debugfs.ocfs2: fix NULL pointer dereference risk in dump_dir_entry

Valentin Vidic vvidic-guest at moszumanska.debian.org
Tue Jun 20 13:40:41 UTC 2017


This is an automated email from the git hooks/post-receive script.

vvidic-guest pushed a commit to branch upstream
in repository ocfs2-tools.

commit 0e81a7dbf1e64b712f4db4b67d9743ff598a301f
Author: Joseph Qi <joseph.qi at huawei.com>
Date:   Tue Jul 26 17:05:43 2016 +0800

    debugfs.ocfs2: fix NULL pointer dereference risk in dump_dir_entry
    
    ls->buf may be 0 if ocfs2_read_inode fails, so check the return value to
    prevent NULL pointer dereference risk.
    
    Signed-off-by: Joseph Qi <joseph.qi at huawei.com>
    Reviewed-by: Eric Ren <zren at suse.com>
---
 debugfs.ocfs2/dump.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/debugfs.ocfs2/dump.c b/debugfs.ocfs2/dump.c
index da95a14..8969493 100644
--- a/debugfs.ocfs2/dump.c
+++ b/debugfs.ocfs2/dump.c
@@ -511,6 +511,7 @@ int dump_dir_entry(struct ocfs2_dir_entry *rec, uint64_t blocknr, int offset,
 	struct ocfs2_dinode *di;
 	char perms[20];
 	char timestr[40];
+	errcode_t ret;
 
 	rec->name[rec->name_len] = '\0';
 
@@ -520,7 +521,10 @@ int dump_dir_entry(struct ocfs2_dir_entry *rec, uint64_t blocknr, int offset,
 			rec->rec_len, rec->name_len, rec->file_type, rec->name);
 	} else {
 		memset(ls->buf, 0, ls->fs->fs_blocksize);
-		ocfs2_read_inode(ls->fs, rec->inode, ls->buf);
+		ret = ocfs2_read_inode(ls->fs, rec->inode, ls->buf);
+		if (ret)
+			return ret;
+
 		di = (struct ocfs2_dinode *)ls->buf;
 
 		inode_perms_to_str(di->i_mode, perms, sizeof(perms));

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-ha/ocfs2-tools.git



More information about the Debian-HA-Commits mailing list