diff options
author | Michael Kerrisk <mtk.manpages@googlemail.com> | 2008-06-09 21:16:08 -0700 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2008-06-23 08:43:04 -0400 |
commit | 4cca92264e61a90b43fc4e076cd25b7f4e16dc61 (patch) | |
tree | f7472b3dc27101761b92bb05ffff7785a73317f3 /fs/autofs | |
parent | 94c70b9ba7e9c1036284e779e2fef5be89021533 (diff) | |
download | blackbird-op-linux-4cca92264e61a90b43fc4e076cd25b7f4e16dc61.tar.gz blackbird-op-linux-4cca92264e61a90b43fc4e076cd25b7f4e16dc61.zip |
[patch for 2.6.26 3/4] vfs: utimensat(): fix error checking for {UTIME_NOW,UTIME_OMIT} case
The POSIX.1 draft spec for utimensat() says:
Only a process with the effective user ID equal to the
user ID of the file or with appropriate privileges may use
futimens() or utimensat() with a non-null times argument
that does not have both tv_nsec fields set to UTIME_NOW
and does not have both tv_nsec fields set to UTIME_OMIT.
If this condition is violated, then the error EPERM should result.
However, the current implementation does not generate EPERM if
one tv_nsec field is UTIME_NOW while the other is UTIME_OMIT.
It should give this error for that case.
This patch:
a) Repairs that problem.
b) Removes the now unneeded nsec_special() helper function.
c) Adds some comments to explain the checks that are being
performed.
Thanks to Miklos, who provided comments on the previous iteration
of this patch. As a result, this version is a little simpler and
and its logic is better structured.
Miklos suggested an alternative idea, migrating the
is_owner_or_cap() checks into fs/attr.c:inode_change_ok() via
the use of an ATTR_OWNER_CHECK flag. Maybe we could do that
later, but for now I've gone with this version, which is
IMO simpler, and can be more easily read as being correct.
Acked-by: Miklos Szeredi <miklos@szeredi.hu>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Ulrich Drepper <drepper@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/autofs')
0 files changed, 0 insertions, 0 deletions