diff options
author | Ding Xiang <dingxiang@cmss.chinamobile.com> | 2019-09-09 16:29:56 +0800 |
---|---|---|
committer | Miklos Szeredi <mszeredi@redhat.com> | 2019-09-11 16:11:45 +0200 |
commit | 97f024b9171e74c4443bbe8a8dce31b917f97ac5 (patch) | |
tree | e9270122b31d9d5a1e9d28f5c7e6bb0c8ce35ec3 | |
parent | 0be0bfd2de9dfdd2098a9c5b14bdd8f739c9165d (diff) | |
download | linux-97f024b9171e74c4443bbe8a8dce31b917f97ac5.tar.bz2 |
ovl: Fix dereferencing possible ERR_PTR()
if ovl_encode_real_fh() fails, no memory was allocated
and the error in the error-valued pointer should be returned.
Fixes: 9b6faee07470 ("ovl: check ERR_PTR() return value from ovl_encode_fh()")
Signed-off-by: Ding Xiang <dingxiang@cmss.chinamobile.com>
Cc: <stable@vger.kernel.org> # v4.16+
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
-rw-r--r-- | fs/overlayfs/export.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/fs/overlayfs/export.c b/fs/overlayfs/export.c index cb8ec1f65c03..73c9775215b3 100644 --- a/fs/overlayfs/export.c +++ b/fs/overlayfs/export.c @@ -227,9 +227,8 @@ static int ovl_d_to_fh(struct dentry *dentry, char *buf, int buflen) /* Encode an upper or lower file handle */ fh = ovl_encode_real_fh(enc_lower ? ovl_dentry_lower(dentry) : ovl_dentry_upper(dentry), !enc_lower); - err = PTR_ERR(fh); if (IS_ERR(fh)) - goto fail; + return PTR_ERR(fh); err = -EOVERFLOW; if (fh->len > buflen) |