浏览代码

ceph: Fix NULL ptr crash in strlen()

set_request_path_attr() checks for NULL ptr before calling strlen()

This fixes http://tracker.newdream.net/issues/3404

Signed-off-by: David Zafman <david.zafman@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
David Zafman 12 年之前
父节点
当前提交
b000056a5a
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      fs/ceph/mds_client.c

+ 1 - 1
fs/ceph/mds_client.c

@@ -1590,7 +1590,7 @@ static int set_request_path_attr(struct inode *rinode, struct dentry *rdentry,
 	} else if (rpath || rino) {
 		*ino = rino;
 		*ppath = rpath;
-		*pathlen = strlen(rpath);
+		*pathlen = rpath ? strlen(rpath) : 0;
 		dout(" path %.*s\n", *pathlen, rpath);
 	}