ovl: check ERR_PTR() return value from ovl_encode_fh()
authorAmir Goldstein <amir73il@gmail.com>
Tue, 30 Jan 2018 11:54:45 +0000 (13:54 +0200)
committerMiklos Szeredi <mszeredi@redhat.com>
Mon, 5 Feb 2018 08:50:29 +0000 (09:50 +0100)
Another fix for an issue reported by 0-day robot.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Fixes: 8ed5eec9d6c4 ("ovl: encode pure upper file handles")
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
fs/overlayfs/export.c

index b65ea49de45741c20b9e6b88dc70328a6ac80543..bb94ce9da5c8723b9f35a9195f5e8926c9e83b91 100644 (file)
@@ -108,6 +108,9 @@ static int ovl_d_to_fh(struct dentry *dentry, char *buf, int buflen)
 
        /* Encode an upper or origin file handle */
        fh = ovl_encode_fh(origin ?: ovl_dentry_upper(dentry), !origin);
+       err = PTR_ERR(fh);
+       if (IS_ERR(fh))
+               goto fail;
 
        err = -EOVERFLOW;
        if (fh->len > buflen)