aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGilbert Ashley Gilbert <amigo@ibiblio.org>2008-09-06 10:20:00 +0200
committerWilly Tarreau <w@1wt.eu>2008-09-06 16:29:40 +0200
commit3710cd7f4aa09228083ef8aec7d5baf945789756 (patch)
treee00bf0bebf9a5db19f255e93df10c38097a2766e
parentb49bf2e6a662c42f4e3dda75f3b912e85589c8ed (diff)
downloadlinux-2.4-3710cd7f4aa09228083ef8aec7d5baf945789756.tar.gz
udf: fix uid/gid permissions
This change made it into the 2.6 branch since 2.6.15 and fixes a problem where the UDF code would change the ownership of files in a UDF filesystem when they were different thatn the current user, when possible. Example: after creating a CD using udf as a regular user, if you mounted the CD as root, the udf code would reset the ownership of all the files on the cd, causing unecessary write operations. I found this fix while working with an old patch which adds packet-writing to the 2.4 kernel. This fix is from the original author (or maintainer) of the udf code. Note: this was fixed upstream in 4d6660eb3665f22d16aff466eb9d45df6102b254.
-rw-r--r--fs/udf/inode.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index 72cdc308c8981d..8e03eea21ddf56 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -1363,9 +1363,13 @@ udf_update_inode(struct inode *inode, int do_sync)
if (inode->i_uid != UDF_SB(inode->i_sb)->s_uid)
fe->uid = cpu_to_le32(inode->i_uid);
+ else
+ fe->uid = cpu_to_le32(-1);
if (inode->i_gid != UDF_SB(inode->i_sb)->s_gid)
fe->gid = cpu_to_le32(inode->i_gid);
+ else
+ fe->uid = cpu_to_le32(-1);
udfperms = ((inode->i_mode & S_IRWXO) ) |
((inode->i_mode & S_IRWXG) << 2) |