ceph: Fix NULL ptr crash in strlen()
authorDavid Zafman <david.zafman@inktank.com>
Thu, 25 Oct 2012 17:23:46 +0000 (10:23 -0700)
committerAlex Elder <elder@inktank.com>
Fri, 26 Oct 2012 21:35:07 +0000 (16:35 -0500)
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>
fs/ceph/mds_client.c

index 1bcf712655d90a6001db4e8de8e86cfa3a70187d..62d2342eb26795cb5e05d0546c17a2d4b69c5bcf 100644 (file)
@@ -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);
        }