[patch 12/24] vfs: utimes immutable fix

From: Miklos Szeredi
Date: Tue May 06 2008 - 05:25:57 EST


From: Miklos Szeredi <mszeredi@xxxxxxx>

If updating file times to the current time and using a file
descriptor, then don't check for immutable inode, only if the file is
opened for write. In this case immutability has been checked at open
time. This is the same as how write() and ftruncate() are handled.

Signed-off-by: Miklos Szeredi <mszeredi@xxxxxxx>
CC: Ulrich Drepper <drepper@xxxxxxxxxx>
---
fs/utimes.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6/fs/utimes.c
===================================================================
--- linux-2.6.orig/fs/utimes.c 2008-05-06 11:04:35.000000000 +0200
+++ linux-2.6/fs/utimes.c 2008-05-06 11:04:36.000000000 +0200
@@ -130,7 +130,7 @@ long do_utimes(int dfd, char __user *fil
if (!times || (nsec_special(times[0].tv_nsec) &&
nsec_special(times[1].tv_nsec))) {
error = -EACCES;
- if (IS_IMMUTABLE(inode))
+ if (!f && IS_IMMUTABLE(inode))
goto mnt_drop_write_and_out;

if (!is_owner_or_cap(inode)) {

--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/