[RHEL8,COMMIT] ms/ovl: Fix dereferencing possible ERR_PTR()

Submitted by Konstantin Khorenko on June 16, 2020, 10:47 a.m.

Details

Message ID 202006161047.05GAlsib011080@finist-co8.sw.ru
State New
Headers show

Patch hide | download patch | download mbox

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)