summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmir Goldstein <amir73il@gmail.com>2018-01-30 14:54:45 +0300
committerMiklos Szeredi <mszeredi@redhat.com>2018-02-05 11:50:29 +0300
commit9b6faee074702bbbc207e7027b9416c2d8fea9fe (patch)
treec9a15042ac2e9e6ca796c66c4005d6befffe2ef0
parent2aed489d163a6559e07dbc238882c9970ae0f65b (diff)
downloadlinux-9b6faee074702bbbc207e7027b9416c2d8fea9fe.tar.xz
ovl: check ERR_PTR() return value from ovl_encode_fh()
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>
-rw-r--r--fs/overlayfs/export.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/overlayfs/export.c b/fs/overlayfs/export.c
index b65ea49de457..bb94ce9da5c8 100644
--- a/fs/overlayfs/export.c
+++ b/fs/overlayfs/export.c
@@ -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)