diff options
Diffstat (limited to 'fs/ext3')
-rw-r--r-- | fs/ext3/acl.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/fs/ext3/acl.c b/fs/ext3/acl.c index 2cf6a8044c80..dbb5ad59a7fc 100644 --- a/fs/ext3/acl.c +++ b/fs/ext3/acl.c | |||
@@ -48,16 +48,23 @@ ext3_acl_from_disk(const void *value, size_t size) | |||
48 | case ACL_OTHER: | 48 | case ACL_OTHER: |
49 | value = (char *)value + | 49 | value = (char *)value + |
50 | sizeof(ext3_acl_entry_short); | 50 | sizeof(ext3_acl_entry_short); |
51 | acl->a_entries[n].e_id = ACL_UNDEFINED_ID; | ||
52 | break; | 51 | break; |
53 | 52 | ||
54 | case ACL_USER: | 53 | case ACL_USER: |
54 | value = (char *)value + sizeof(ext3_acl_entry); | ||
55 | if ((char *)value > end) | ||
56 | goto fail; | ||
57 | acl->a_entries[n].e_uid = | ||
58 | make_kuid(&init_user_ns, | ||
59 | le32_to_cpu(entry->e_id)); | ||
60 | break; | ||
55 | case ACL_GROUP: | 61 | case ACL_GROUP: |
56 | value = (char *)value + sizeof(ext3_acl_entry); | 62 | value = (char *)value + sizeof(ext3_acl_entry); |
57 | if ((char *)value > end) | 63 | if ((char *)value > end) |
58 | goto fail; | 64 | goto fail; |
59 | acl->a_entries[n].e_id = | 65 | acl->a_entries[n].e_gid = |
60 | le32_to_cpu(entry->e_id); | 66 | make_kgid(&init_user_ns, |
67 | le32_to_cpu(entry->e_id)); | ||
61 | break; | 68 | break; |
62 | 69 | ||
63 | default: | 70 | default: |
@@ -91,14 +98,19 @@ ext3_acl_to_disk(const struct posix_acl *acl, size_t *size) | |||
91 | ext_acl->a_version = cpu_to_le32(EXT3_ACL_VERSION); | 98 | ext_acl->a_version = cpu_to_le32(EXT3_ACL_VERSION); |
92 | e = (char *)ext_acl + sizeof(ext3_acl_header); | 99 | e = (char *)ext_acl + sizeof(ext3_acl_header); |
93 | for (n=0; n < acl->a_count; n++) { | 100 | for (n=0; n < acl->a_count; n++) { |
101 | const struct posix_acl_entry *acl_e = &acl->a_entries[n]; | ||
94 | ext3_acl_entry *entry = (ext3_acl_entry *)e; | 102 | ext3_acl_entry *entry = (ext3_acl_entry *)e; |
95 | entry->e_tag = cpu_to_le16(acl->a_entries[n].e_tag); | 103 | entry->e_tag = cpu_to_le16(acl_e->e_tag); |
96 | entry->e_perm = cpu_to_le16(acl->a_entries[n].e_perm); | 104 | entry->e_perm = cpu_to_le16(acl_e->e_perm); |
97 | switch(acl->a_entries[n].e_tag) { | 105 | switch(acl_e->e_tag) { |
98 | case ACL_USER: | 106 | case ACL_USER: |
107 | entry->e_id = cpu_to_le32( | ||
108 | from_kuid(&init_user_ns, acl_e->e_uid)); | ||
109 | e += sizeof(ext3_acl_entry); | ||
110 | break; | ||
99 | case ACL_GROUP: | 111 | case ACL_GROUP: |
100 | entry->e_id = | 112 | entry->e_id = cpu_to_le32( |
101 | cpu_to_le32(acl->a_entries[n].e_id); | 113 | from_kgid(&init_user_ns, acl_e->e_gid)); |
102 | e += sizeof(ext3_acl_entry); | 114 | e += sizeof(ext3_acl_entry); |
103 | break; | 115 | break; |
104 | 116 | ||