diff options
author | Ding Xiang <dingxiang@cmss.chinamobile.com> | 2019-09-09 16:29:56 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-10-05 13:10:08 +0200 |
commit | e7265adc0a3c87b5fe9ddbbc55293647ac7338b6 (patch) | |
tree | 9e697249270a08e7d24e8b077c7ff7d00d840292 /fs | |
parent | 2e96c93325950db4ca9d8eb73cf93b20e5500938 (diff) | |
download | linux-rt-e7265adc0a3c87b5fe9ddbbc55293647ac7338b6.tar.gz |
ovl: Fix dereferencing possible ERR_PTR()
commit 97f024b9171e74c4443bbe8a8dce31b917f97ac5 upstream.
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-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 54e5d17d7f3e..6fe303850c9e 100644 --- a/fs/overlayfs/export.c +++ b/fs/overlayfs/export.c @@ -230,9 +230,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) |