[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200610095934.GA35167@mwanda>
Date: Wed, 10 Jun 2020 12:59:34 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Namjae Jeon <namjae.jeon@...sung.com>,
linux-fsdevel@...r.kernel.org,
Sungjong Seo <sj1557.seo@...sung.com>
Cc: kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org,
Pali Rohár <pali@...nel.org>,
Tetsuhiro Kohada <kohada.t2@...il.com>,
Wei Yongjun <weiyongjun1@...wei.com>
Subject: [PATCH] exfat: call brelse() on error path
If the second exfat_get_dentry() call fails then we need to release
"old_bh" before returning.
Reported-by: Markus Elfring <Markus.Elfring@....de>
Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
---
fs/exfat/namei.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/fs/exfat/namei.c b/fs/exfat/namei.c
index 5b0f35329d63e..fda92c824ff11 100644
--- a/fs/exfat/namei.c
+++ b/fs/exfat/namei.c
@@ -1077,10 +1077,14 @@ static int exfat_rename_file(struct inode *inode, struct exfat_chain *p_dir,
epold = exfat_get_dentry(sb, p_dir, oldentry + 1, &old_bh,
§or_old);
+ if (!epold)
+ return -EIO;
epnew = exfat_get_dentry(sb, p_dir, newentry + 1, &new_bh,
§or_new);
- if (!epold || !epnew)
+ if (!epnew) {
+ brelse(old_bh);
return -EIO;
+ }
memcpy(epnew, epold, DENTRY_SIZE);
exfat_update_bh(sb, new_bh, sync);
--
2.26.2
Powered by blists - more mailing lists