Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 97f024b9 authored by Ding Xiang's avatar Ding Xiang Committed by Miklos Szeredi
Browse files

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: 9b6faee0 ("ovl: check ERR_PTR() return value from ovl_encode_fh()")
Signed-off-by: default avatarDing Xiang <dingxiang@cmss.chinamobile.com>
Cc: <stable@vger.kernel.org> # v4.16+
Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
parent 0be0bfd2
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -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)