vfs: fix permission checking in sys_utimensatv2.6.22.23-opt2
commit1a6e679766ed55a2996d38ea3ce527ca56d04917
authorMiklos Szeredi <mszeredi@suse.cz>
Thu, 1 May 2008 11:34:45 +0000 (1 04:34 -0700)
committerOliver Pinter <oliver.pntr@gmail.com>
Sat, 3 May 2008 12:51:42 +0000 (3 14:51 +0200)
treee002c7dce4cd1c2915cd679d78063de48fa7fa13
parented025959c93180b46c3cf84f58d4753351687ad5
vfs: fix permission checking in sys_utimensat

If utimensat() is called with both times set to UTIME_NOW or one of them to
UTIME_NOW and the other to UTIME_OMIT, then it will update the file time
without any permission checking.

I don't think this can be used for anything other than a local DoS, but could
be quite bewildering at that (e.g.  "Why was that large source tree rebuilt
when I didn't modify anything???")

This affects all kernels from 2.6.22, when the utimensat() syscall was
introduced.

Fix by doing the same permission checking as for the "times == NULL" case.

Thanks to Michael Kerrisk, whose utimensat-non-conformances-and-fixes.patch in
-mm also fixes this (and breaks other stuff), only he didn't realize the
security implications of this bug.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Cc: Ulrich Drepper <drepper@redhat.com>
Cc: Michael Kerrisk <mtk-manpages@gmx.net>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Backported-to-2.6.22.y: Oliver Pinter <oliver.pntr@gmail.com>
fs/utimes.c