|
Kmods SIG |
50e2b3 |
From e8dd3cda8667118b70d9fe527f61fe22623de04d Mon Sep 17 00:00:00 2001
|
|
Kmods SIG |
50e2b3 |
From: Dan Carpenter <dan.carpenter@oracle.com>
|
|
Kmods SIG |
50e2b3 |
Date: Wed, 10 Jun 2020 20:22:13 +0300
|
|
Kmods SIG |
50e2b3 |
Subject: [Backport e8dd3cda8667] exfat: add missing brelse() calls on error
|
|
Kmods SIG |
50e2b3 |
paths
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
If the second exfat_get_dentry() call fails then we need to release
|
|
Kmods SIG |
50e2b3 |
"old_bh" before returning. There is a similar bug in exfat_move_file().
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
Fixes: 5f2aa075070c ("exfat: add inode operations")
|
|
Kmods SIG |
50e2b3 |
Reported-by: Markus Elfring <Markus.Elfring@web.de>
|
|
Kmods SIG |
50e2b3 |
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
|
|
Kmods SIG |
50e2b3 |
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
|
|
Kmods SIG |
50e2b3 |
---
|
|
Kmods SIG |
50e2b3 |
src/namei.c | 12 ++++++++++--
|
|
Kmods SIG |
50e2b3 |
1 file changed, 10 insertions(+), 2 deletions(-)
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
diff --git a/src/namei.c b/src/namei.c
|
|
Kmods SIG |
50e2b3 |
index 5b0f35329d63e0b9ab52162e4fbad129601c458d..edd8023865a0e50d0854856ab57afc75ce56dd46 100644
|
|
Kmods SIG |
50e2b3 |
--- a/src/namei.c
|
|
Kmods SIG |
50e2b3 |
+++ b/src/namei.c
|
|
Kmods SIG |
50e2b3 |
@@ -1077,10 +1077,14 @@ static int exfat_rename_file(struct inode *inode, struct exfat_chain *p_dir,
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
epold = exfat_get_dentry(sb, p_dir, oldentry + 1, &old_bh,
|
|
Kmods SIG |
50e2b3 |
§or_old);
|
|
Kmods SIG |
50e2b3 |
+ if (!epold)
|
|
Kmods SIG |
50e2b3 |
+ return -EIO;
|
|
Kmods SIG |
50e2b3 |
epnew = exfat_get_dentry(sb, p_dir, newentry + 1, &new_bh,
|
|
Kmods SIG |
50e2b3 |
§or_new);
|
|
Kmods SIG |
50e2b3 |
- if (!epold || !epnew)
|
|
Kmods SIG |
50e2b3 |
+ if (!epnew) {
|
|
Kmods SIG |
50e2b3 |
+ brelse(old_bh);
|
|
Kmods SIG |
50e2b3 |
return -EIO;
|
|
Kmods SIG |
50e2b3 |
+ }
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
memcpy(epnew, epold, DENTRY_SIZE);
|
|
Kmods SIG |
50e2b3 |
exfat_update_bh(sb, new_bh, sync);
|
|
Kmods SIG |
50e2b3 |
@@ -1161,10 +1165,14 @@ static int exfat_move_file(struct inode *inode, struct exfat_chain *p_olddir,
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
epmov = exfat_get_dentry(sb, p_olddir, oldentry + 1, &mov_bh,
|
|
Kmods SIG |
50e2b3 |
§or_mov);
|
|
Kmods SIG |
50e2b3 |
+ if (!epmov)
|
|
Kmods SIG |
50e2b3 |
+ return -EIO;
|
|
Kmods SIG |
50e2b3 |
epnew = exfat_get_dentry(sb, p_newdir, newentry + 1, &new_bh,
|
|
Kmods SIG |
50e2b3 |
§or_new);
|
|
Kmods SIG |
50e2b3 |
- if (!epmov || !epnew)
|
|
Kmods SIG |
50e2b3 |
+ if (!epnew) {
|
|
Kmods SIG |
50e2b3 |
+ brelse(mov_bh);
|
|
Kmods SIG |
50e2b3 |
return -EIO;
|
|
Kmods SIG |
50e2b3 |
+ }
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
memcpy(epnew, epmov, DENTRY_SIZE);
|
|
Kmods SIG |
50e2b3 |
exfat_update_bh(sb, new_bh, IS_DIRSYNC(inode));
|
|
Kmods SIG |
50e2b3 |
--
|
|
Kmods SIG |
50e2b3 |
2.31.1
|
|
Kmods SIG |
50e2b3 |
|