Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F156649390
D24596.id71066.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D24596.id71066.diff
View Options
Index: sys/fs/ext2fs/ext2_vnops.c
===================================================================
--- sys/fs/ext2fs/ext2_vnops.c
+++ sys/fs/ext2fs/ext2_vnops.c
@@ -2073,7 +2073,7 @@
if (vp->v_type == VLNK) {
if ((int)ip->i_size < vp->v_mount->mnt_maxsymlinklen)
panic("%s: short symlink", "ext2_read");
- } else if (vp->v_type != VREG && vp->v_type != VDIR)
+ } else if (vp->v_type != VREG)
panic("%s: type %d", "ext2_read", vp->v_type);
#endif
orig_resid = uio->uio_resid;
Index: sys/fs/msdosfs/msdosfs_vnops.c
===================================================================
--- sys/fs/msdosfs/msdosfs_vnops.c
+++ sys/fs/msdosfs/msdosfs_vnops.c
@@ -520,7 +520,6 @@
{
int error = 0;
int blsize;
- int isadir;
ssize_t orig_resid;
u_int n;
u_long diff;
@@ -552,7 +551,6 @@
seqcount = ap->a_ioflag >> IO_SEQSHIFT;
- isadir = dep->de_Attributes & ATTR_DIRECTORY;
do {
if (uio->uio_offset >= dep->de_FileSize)
break;
@@ -560,21 +558,7 @@
rablock = lbn + 1;
blsize = pmp->pm_bpcluster;
on = uio->uio_offset & pmp->pm_crbomask;
- /*
- * If we are operating on a directory file then be sure to
- * do i/o with the vnode for the filesystem instead of the
- * vnode for the directory.
- */
- if (isadir) {
- /* convert cluster # to block # */
- error = pcbmap(dep, lbn, &lbn, 0, &blsize);
- if (error == E2BIG) {
- error = EINVAL;
- break;
- } else if (error)
- break;
- error = bread(pmp->pm_devvp, lbn, blsize, NOCRED, &bp);
- } else if (de_cn2off(pmp, rablock) >= dep->de_FileSize) {
+ if (de_cn2off(pmp, rablock) >= dep->de_FileSize) {
error = bread(vp, lbn, blsize, NOCRED, &bp);
} else if ((vp->v_mount->mnt_flag & MNT_NOCLUSTERR) == 0) {
error = cluster_read(vp, dep->de_FileSize, lbn, blsize,
@@ -601,7 +585,7 @@
error = vn_io_fault_uiomove(bp->b_data + on, (int) n, uio);
brelse(bp);
} while (error == 0 && uio->uio_resid > 0 && n != 0);
- if (!isadir && (error == 0 || uio->uio_resid != orig_resid) &&
+ if ((error == 0 || uio->uio_resid != orig_resid) &&
(vp->v_mount->mnt_flag & (MNT_NOATIME | MNT_RDONLY)) == 0)
dep->de_flag |= DE_ACCESS;
return (error);
Index: sys/fs/smbfs/smbfs_vnops.c
===================================================================
--- sys/fs/smbfs/smbfs_vnops.c
+++ sys/fs/smbfs/smbfs_vnops.c
@@ -502,7 +502,7 @@
struct uio *uio = ap->a_uio;
SMBVDEBUG("\n");
- if (vp->v_type != VREG && vp->v_type != VDIR)
+ if (vp->v_type != VREG)
return EPERM;
return smbfs_readvnode(vp, uio, ap->a_cred);
}
Index: sys/kern/vfs_vnops.c
===================================================================
--- sys/kern/vfs_vnops.c
+++ sys/kern/vfs_vnops.c
@@ -1160,6 +1160,8 @@
doio = uio->uio_rw == UIO_READ ? vn_read : vn_write;
vp = fp->f_vnode;
+ if (vp->v_type == VDIR)
+ return (EISDIR);
foffset_lock_uio(fp, uio, flags);
if (do_vn_io_fault(vp, uio)) {
args.kind = VN_IO_FAULT_FOP;
Index: sys/ufs/ffs/ffs_vnops.c
===================================================================
--- sys/ufs/ffs/ffs_vnops.c
+++ sys/ufs/ffs/ffs_vnops.c
@@ -566,7 +566,7 @@
if (vp->v_type == VLNK) {
if ((int)ip->i_size < vp->v_mount->mnt_maxsymlinklen)
panic("ffs_read: short symlink");
- } else if (vp->v_type != VREG && vp->v_type != VDIR)
+ } else if (vp->v_type != VREG)
panic("ffs_read: type %d", vp->v_type);
#endif
orig_resid = uio->uio_resid;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, May 16, 9:41 AM (16 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33125447
Default Alt Text
D24596.id71066.diff (3 KB)
Attached To
Mode
D24596: vfs: add restrictions to read(2) of a directory
Attached
Detach File
Event Timeline
Log In to Comment