Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 25 Aug 2024 15:02:26 GMT
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 0b2c159c8faa - main - msdosfs: return ENOENT if looking up invalid name for OPEN or DELETE
Message-ID:  <202408251502.47PF2QDo093950@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=0b2c159c8faa3ca155412a1b2e57b3d6bcf91880

commit 0b2c159c8faa3ca155412a1b2e57b3d6bcf91880
Author:     Jose Luis Duran <jlduran@gmail.com>
AuthorDate: 2024-08-25 14:50:53 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-08-25 14:50:53 +0000

    msdosfs: return ENOENT if looking up invalid name for OPEN or DELETE
    
    and keep reporting EINVAL for CREATE or RENAME lookups.  The reasoning is
    that non-corrupted filesystem cannot have invalid dirents anyway, so
    returning ENOENT is more in-line with the natural behavior.
    
    PR:     281033
    MFC after:      1 week
---
 sys/fs/msdosfs/msdosfs_lookup.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sys/fs/msdosfs/msdosfs_lookup.c b/sys/fs/msdosfs/msdosfs_lookup.c
index 2a90339d0878..e799a5ce05f6 100644
--- a/sys/fs/msdosfs/msdosfs_lookup.c
+++ b/sys/fs/msdosfs/msdosfs_lookup.c
@@ -198,7 +198,9 @@ msdosfs_lookup_ino(struct vnode *vdp, struct vnode **vpp, struct componentname
 	switch (unix2dosfn((const u_char *)cnp->cn_nameptr, dosfilename,
 	    cnp->cn_namelen, 0, pmp)) {
 	case 0:
-		return (EINVAL);
+		if (nameiop == CREATE || nameiop == RENAME)
+			return (EINVAL);
+		return (ENOENT);
 	case 1:
 		break;
 	case 2:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202408251502.47PF2QDo093950>