Commit Graph

327 Commits

Author SHA1 Message Date
christos
aa2ab5b195 fix udf_node leak. Reported by:
http://www.m00nbsd.net/ae123a9bae03f7dde5c6d654412daf5a.html#Report-4
2015-02-07 04:18:03 +00:00
martin
acbabd6a6a When udf_symlink() fails, do not explicitly call udf_delete_node(), as
vrele() called next will do that again - avoids a double free of the
bitmap, leading to a KASSERT failure (or worse in real life) in the
udf_symlink_long in the fs/vfs::t_vnops test.
2015-01-28 14:00:58 +00:00
reinoud
5d76927e7e Add missing vrele() as found by the testsuite.
Thanks Jurgen Hannken for the patch.
2015-01-04 14:23:37 +00:00
reinoud
65b5af65e0 Explicitly delete the failing node; it would be killed with the unlink too but
explicitly deleting it is better than just setting the file size to zero.
2014-12-03 21:37:55 +00:00
reinoud
a2b485ee86 Relax the KASSERT since an equal size is no issue 2014-12-03 21:34:55 +00:00
riz
28fe942ff2 Revert previous, it is actually needed. (builds are failing) 2014-11-10 19:44:08 +00:00
maxv
fcc99ce60e Do not uselessly include <sys/malloc.h>. 2014-11-10 18:46:33 +00:00
uebayasi
fe9a32c84e Define filesystem attributes with vfs dependency. 2014-10-11 06:42:18 +00:00
reinoud
ef40ac265a Fix bug introduced in last patch 2014-09-17 21:18:43 +00:00
reinoud
79652a00ee As pointed out by wiz@ prevent a possible attack or corruption that results in
an endless loop of indirect descriptors being processed.

The number of indirect descriptors followed is now maximized.
While here, also fix a use-after-free bug!
2014-09-17 19:47:05 +00:00
reinoud
e3b6b3457e Posix requires the va_size of a symlink to be pathlength for symbolic links.
This fixes yet another atf case.
2014-07-29 15:48:22 +00:00
reinoud
60e6f474d5 Fix debug printout of udf_write_metadata_partition_spacetable(), it referred
to an old variable.
2014-07-29 15:36:43 +00:00
reinoud
a72b8dae23 Access time should only be set on accessing the data or messing with the
contents, not on inode access rights and ownership changes. Should address
PR kern/49033 for UDF.

Test results now come clean for bugs related to this issue in the ATF.
2014-07-29 11:10:12 +00:00
dholland
05d075b3ae Add VOP_FALLOCATE and VOP_FDISCARD to every vnode ops table I can
find.

The filesystem ones all call genfs_eopnotsupp - right now I am only
implementing the plumbing and we can implement fallocate and/or
fdiscard for files later.

The device ones call spec_fallocate (which is also genfs_eopnotsupp)
and spec_fdiscard, which dispatches to the device-level op.

The fifo ones all call vn_fifo_bypass, which also ends up being
EOPNOTSUPP.
2014-07-25 08:20:51 +00:00
maxv
23f76b6d00 An (un)privileged user can easily make the kernel dereference a NULL
pointer.

The kernel allows 'data' to be NULL; it's the fs's responsibility to
ensure that it isn't NULL (if the fs actually needs data).

ok christos@
2014-04-16 18:55:17 +00:00
hannken
6d285189fb Change all vfsops to use C99 designated initializers.
No functional changes intended.
2014-03-23 15:21:15 +00:00
christos
0f18888b15 fix unused 2014-03-23 09:30:59 +00:00
pooka
4f6fb3bf35 Ensure that the top level sysctl nodes (kern, vfs, net, ...) exist before
the sysctl link sets are processed, and remove redundancy.

Shaves >13kB off of an amd64 GENERIC, not to mention >1k duplicate
lines of code.
2014-02-25 18:30:08 +00:00
hannken
97834f7ba0 Change vnode operation lookup to return the resulting vnode *vpp unlocked.
Change cache_lookup() to return an unlocked vnode.

Discussed on tech-kern@

Welcome to 6.99.31
2014-02-07 15:29:20 +00:00
hannken
04c776e5c8 Change vnode operations create, mknod, mkdir and symlink to return
the resulting vnode *vpp unlocked.

Discussed on tech-kern@

Welcome to 6.99.30
2014-01-23 10:13:55 +00:00
hannken
1139274440 Change vnode operations create, mknod, mkdir and symlink to keep the
directory node dvp locked on return.

Discussed on tech-kern@

Welcome to 6.99.29
2014-01-17 10:55:01 +00:00
riz
1000f7c1af Don't create a variable just to assert() on it - assert on the
thing the variable got assigned.
2013-11-21 23:42:09 +00:00
mrg
4cf2909a7b used __diagused where appropriate. 2013-10-30 08:41:38 +00:00
christos
91b2f42c8c fix unused variable warnings 2013-10-18 19:56:55 +00:00
hannken
85b4f7dccf Remove a bogus vrecycle() from udf_inactive(). Vrecycle() works on inactive
vnodes while VOP_INACTIVE() should never be called on an inactive vnode.

Ok: Reinoud Zandijk <reinoud@netbsd.org>
2013-10-04 08:35:08 +00:00
hannken
3881f4f3f9 Replace macro v_specmountpoint with two functions spec_node_getmountedfs()
and spec_node_setmountedfs() to manage the file system mounted on a device.
Assert the device is a block device.

Welcome to 6.99.24

Discussed on tech-kern@ some time ago.

Reviewed by: David Holland <dholland@netbsd.org>
2013-09-30 18:57:59 +00:00
reinoud
550f8483a8 Fix 32 bit issue in main file read-in function. On both 32 bit and 64 bit
hosts a missing cast would result in `garbage' after the 4Gbyte limit.
2013-08-09 20:13:18 +00:00
joerg
45b48fe34b Support tools build. 2013-08-05 17:02:54 +00:00
reinoud
420d7ac724 Remove udf_node * as state variables and add the loop invariants UFS and tmpfs
carry to make it easier to debug.
2013-07-16 10:49:36 +00:00
reinoud
4600888a4b First step in rewriting the genealogy case 2013-07-15 14:40:21 +00:00
reinoud
0eb394b1d0 udf_gro_genealogy() : source and destination should never be the same on call,
KASSERT it instead of checking for it.
2013-07-13 19:42:26 +00:00
reinoud
a987c68f3a vp is used, so don't (void) it 2013-07-13 19:40:14 +00:00
reinoud
2b15913865 Rework udf_gro_rename() to be more linear instead of nesting if/else
branching.
2013-07-13 19:39:02 +00:00
reinoud
8ad309e64f In case there is trouble determining the number of entries in a directory,
return its not empty to be on the safe side.
2013-07-12 16:14:10 +00:00
reinoud
d9c51d931b Resort to the easiest way to check if a directory is deleted: the flag that
tells that there is no FID (dirent) pointing to it anymore.
2013-07-11 19:41:19 +00:00
reinoud
da86562477 Small cleanup 2013-07-11 15:43:12 +00:00
reinoud
c689e7fed3 Remove the dirent checks and references. UDF doesn't need/use them on rename
so just to make sure, we remove all references/checks to not trigger bugs
thats are not really ours.
2013-07-10 19:14:07 +00:00
reinoud
a7795a09e4 Implement udf_rename() using the new genfs_rename() framework.
Fixes PR kern/47986
2013-07-10 15:10:56 +00:00
reinoud
1cabaf0e68 Clarify the sticky-bit check 2013-07-08 08:21:12 +00:00
reinoud
a0054fd5a4 Pull forward the node creation returned from the lookup call. Its vnode is
used in the access determination on delete/rename of TXT files.

Thanks for joerg@ and clang for detecting this!
2013-07-07 20:16:22 +00:00
reinoud
eb513d5160 Implement a real empty-directory checking for rmdir().
Should should fix the other part of PR kern/47987
Solves tests/vfs/t_vnops udf_dir_notempty
2013-07-07 19:49:44 +00:00
reinoud
d2126d9622 Fixes chflags. They were silently rejected before but the VFS standard demands
it complains with EOPNOTSUPP.

Fixes chflags test case.
2013-07-05 20:40:20 +00:00
reinoud
16cc237e7c Provide additional checks to udf_lookup and restructure it a bit.
Should fix PR 47988
2013-07-05 20:04:57 +00:00
reinoud
1a547d0334 Remove spurious empty line 2013-07-03 15:39:22 +00:00
reinoud
ab09c24f7a On removing a directory make sure the leaf directory doesn't have a valid '..'
link anymore. In a corner case this leaf can be held by a process as a CWD. It
is guaranteed to be empty at this stage so we trunc it removing the only valid
FID, being the '..' entry.

Solves part of PR kern/47987
Solves tests/vfs/t_vnops udf_dir_rmdirdotdot
2013-07-03 14:35:28 +00:00
reinoud
e6b5374ef7 Typo in debug message: we are removing a directory and not a file. 2013-07-03 12:55:34 +00:00
reinoud
d0b9530090 On growing a node that was recorded inside the (E)FE, don't forget to set the
size of the node to the NEW size. This was reported by the `t_io
udf_shrinkfile' testcase.

Fixes PR kern/47985
2013-07-03 11:50:59 +00:00
reinoud
793c315af2 Since UDF volumes are always mounted async, the simple UBC purging with
VOP_PUTPAGES() was never triggered resulting in far too much data in the UBC
that needed to be written out. This could result in instability on small
memory machines.
2013-06-27 09:38:08 +00:00
plunky
5ec364d4d9 C99 section 6.7.2.3 (Tags) Note 3 states that:
A type specifier of the form

	enum identifier

  without an enumerator list shall only appear after the type it
  specifies is complete.

which means that we cannot pass an "enum vtype" argument to
kauth_access_action() without fully specifying the type first.
Unfortunately there is a complicated include file loop which
makes that difficult, so convert this minimal function into a
macro (and capitalize it).

(ok elad@)
2013-03-18 19:35:35 +00:00
dholland
35ed690545 Excise struct componentname from the namecache.
This uglifies the interface, because several operations need to be
passed the namei flags and cache_lookup also needs for the time being
to be passed cnp->cn_nameiop. Nonetheless, it's a net benefit.

The glop should be able to go away eventually but requires structural
cleanup elsewhere first.

This change requires a kernel bump.
2012-11-05 17:27:37 +00:00