git: be0df84849ff - main - msdosfs_rename(): handle errors from msdosfs_lookup_ino()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 18 Jan 2024 16:48:25 UTC
The branch main has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=be0df84849ff3e8fb5ec65176ffde88dbefdc434
commit be0df84849ff3e8fb5ec65176ffde88dbefdc434
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2024-01-17 22:55:05 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-01-18 16:48:05 +0000
msdosfs_rename(): handle errors from msdosfs_lookup_ino()
Properly working storage and correct filesystem structure indeed only
allow the EJUSTRETURN return code, but since the called function needs
to read directory blocks and (re)parse the content, the assert is not
neccessary hold.
PR: 276408
Reported by: John F. Carr
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D43482
---
sys/fs/msdosfs/msdosfs_vnops.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c
index c17d9f785dc2..726b1d8e5cb7 100644
--- a/sys/fs/msdosfs/msdosfs_vnops.c
+++ b/sys/fs/msdosfs/msdosfs_vnops.c
@@ -1180,8 +1180,8 @@ relock:
memcpy(oldname, fip->de_Name, 11);
memcpy(fip->de_Name, toname, 11); /* update denode */
error = msdosfs_lookup_ino(tdvp, NULL, tcnp, &scn, &blkoff);
- MPASS(error == EJUSTRETURN);
- error = createde(fip, tdip, NULL, tcnp);
+ if (error == EJUSTRETURN)
+ error = createde(fip, tdip, NULL, tcnp);
if (error != 0) {
memcpy(fip->de_Name, oldname, 11);
goto unlock;