Commit 791f2df3 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs

Pull misc filesystem fixes from Jan Kara:
 "Several ACL related fixes for ext2, reiserfs, and hfsplus.

  And also one minor isofs cleanup"

* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
  hfsplus: Don't clear SGID when inheriting ACLs
  isofs: Fix off-by-one in 'session' mount option parsing
  reiserfs: preserve i_mode if __reiserfs_set_acl() fails
  ext2: preserve i_mode if ext2_set_acl() fails
  ext2: Don't clear SGID when inheriting ACLs
  reiserfs: Don't clear SGID when inheriting ACLs
parents 465b0dbb 84969465
...@@ -175,11 +175,8 @@ ext2_get_acl(struct inode *inode, int type) ...@@ -175,11 +175,8 @@ ext2_get_acl(struct inode *inode, int type)
return acl; return acl;
} }
/* static int
* inode->i_mutex: down __ext2_set_acl(struct inode *inode, struct posix_acl *acl, int type)
*/
int
ext2_set_acl(struct inode *inode, struct posix_acl *acl, int type)
{ {
int name_index; int name_index;
void *value = NULL; void *value = NULL;
...@@ -189,13 +186,6 @@ ext2_set_acl(struct inode *inode, struct posix_acl *acl, int type) ...@@ -189,13 +186,6 @@ ext2_set_acl(struct inode *inode, struct posix_acl *acl, int type)
switch(type) { switch(type) {
case ACL_TYPE_ACCESS: case ACL_TYPE_ACCESS:
name_index = EXT2_XATTR_INDEX_POSIX_ACL_ACCESS; name_index = EXT2_XATTR_INDEX_POSIX_ACL_ACCESS;
if (acl) {
error = posix_acl_update_mode(inode, &inode->i_mode, &acl);
if (error)
return error;
inode->i_ctime = current_time(inode);
mark_inode_dirty(inode);
}
break; break;
case ACL_TYPE_DEFAULT: case ACL_TYPE_DEFAULT:
...@@ -221,6 +211,31 @@ ext2_set_acl(struct inode *inode, struct posix_acl *acl, int type) ...@@ -221,6 +211,31 @@ ext2_set_acl(struct inode *inode, struct posix_acl *acl, int type)
return error; return error;
} }
/*
* inode->i_mutex: down
*/
int
ext2_set_acl(struct inode *inode, struct posix_acl *acl, int type)
{
int error;
int update_mode = 0;
umode_t mode = inode->i_mode;
if (type == ACL_TYPE_ACCESS && acl) {
error = posix_acl_update_mode(inode, &mode, &acl);
if (error)
return error;
update_mode = 1;
}
error = __ext2_set_acl(inode, acl, type);
if (!error && update_mode) {
inode->i_mode = mode;
inode->i_ctime = current_time(inode);
mark_inode_dirty(inode);
}
return error;
}
/* /*
* Initialize the ACLs of a new inode. Called from ext2_new_inode. * Initialize the ACLs of a new inode. Called from ext2_new_inode.
* *
...@@ -238,12 +253,12 @@ ext2_init_acl(struct inode *inode, struct inode *dir) ...@@ -238,12 +253,12 @@ ext2_init_acl(struct inode *inode, struct inode *dir)
return error; return error;
if (default_acl) { if (default_acl) {
error = ext2_set_acl(inode, default_acl, ACL_TYPE_DEFAULT); error = __ext2_set_acl(inode, default_acl, ACL_TYPE_DEFAULT);
posix_acl_release(default_acl); posix_acl_release(default_acl);
} }
if (acl) { if (acl) {
if (!error) if (!error)
error = ext2_set_acl(inode, acl, ACL_TYPE_ACCESS); error = __ext2_set_acl(inode, acl, ACL_TYPE_ACCESS);
posix_acl_release(acl); posix_acl_release(acl);
} }
return error; return error;
......
...@@ -51,8 +51,8 @@ struct posix_acl *hfsplus_get_posix_acl(struct inode *inode, int type) ...@@ -51,8 +51,8 @@ struct posix_acl *hfsplus_get_posix_acl(struct inode *inode, int type)
return acl; return acl;
} }
int hfsplus_set_posix_acl(struct inode *inode, struct posix_acl *acl, static int __hfsplus_set_posix_acl(struct inode *inode, struct posix_acl *acl,
int type) int type)
{ {
int err; int err;
char *xattr_name; char *xattr_name;
...@@ -64,12 +64,6 @@ int hfsplus_set_posix_acl(struct inode *inode, struct posix_acl *acl, ...@@ -64,12 +64,6 @@ int hfsplus_set_posix_acl(struct inode *inode, struct posix_acl *acl,
switch (type) { switch (type) {
case ACL_TYPE_ACCESS: case ACL_TYPE_ACCESS:
xattr_name = XATTR_NAME_POSIX_ACL_ACCESS; xattr_name = XATTR_NAME_POSIX_ACL_ACCESS;
if (acl) {
err = posix_acl_update_mode(inode, &inode->i_mode, &acl);
if (err)
return err;
}
err = 0;
break; break;
case ACL_TYPE_DEFAULT: case ACL_TYPE_DEFAULT:
...@@ -105,6 +99,18 @@ int hfsplus_set_posix_acl(struct inode *inode, struct posix_acl *acl, ...@@ -105,6 +99,18 @@ int hfsplus_set_posix_acl(struct inode *inode, struct posix_acl *acl,
return err; return err;
} }
int hfsplus_set_posix_acl(struct inode *inode, struct posix_acl *acl, int type)
{
int err;
if (type == ACL_TYPE_ACCESS && acl) {
err = posix_acl_update_mode(inode, &inode->i_mode, &acl);
if (err)
return err;
}
return __hfsplus_set_posix_acl(inode, acl, type);
}
int hfsplus_init_posix_acl(struct inode *inode, struct inode *dir) int hfsplus_init_posix_acl(struct inode *inode, struct inode *dir)
{ {
int err = 0; int err = 0;
...@@ -122,15 +128,15 @@ int hfsplus_init_posix_acl(struct inode *inode, struct inode *dir) ...@@ -122,15 +128,15 @@ int hfsplus_init_posix_acl(struct inode *inode, struct inode *dir)
return err; return err;
if (default_acl) { if (default_acl) {
err = hfsplus_set_posix_acl(inode, default_acl, err = __hfsplus_set_posix_acl(inode, default_acl,
ACL_TYPE_DEFAULT); ACL_TYPE_DEFAULT);
posix_acl_release(default_acl); posix_acl_release(default_acl);
} }
if (acl) { if (acl) {
if (!err) if (!err)
err = hfsplus_set_posix_acl(inode, acl, err = __hfsplus_set_posix_acl(inode, acl,
ACL_TYPE_ACCESS); ACL_TYPE_ACCESS);
posix_acl_release(acl); posix_acl_release(acl);
} }
return err; return err;
......
...@@ -410,7 +410,11 @@ static int parse_options(char *options, struct iso9660_options *popt) ...@@ -410,7 +410,11 @@ static int parse_options(char *options, struct iso9660_options *popt)
if (match_int(&args[0], &option)) if (match_int(&args[0], &option))
return 0; return 0;
n = option; n = option;
if (n > 99) /*
* Track numbers are supposed to be in range 1-99, the
* mount option starts indexing at 0.
*/
if (n >= 99)
return 0; return 0;
popt->session = n + 1; popt->session = n + 1;
break; break;
...@@ -543,7 +547,7 @@ static unsigned int isofs_get_last_session(struct super_block *sb, s32 session) ...@@ -543,7 +547,7 @@ static unsigned int isofs_get_last_session(struct super_block *sb, s32 session)
vol_desc_start=0; vol_desc_start=0;
ms_info.addr_format=CDROM_LBA; ms_info.addr_format=CDROM_LBA;
if(session >= 0 && session <= 99) { if (session > 0) {
struct cdrom_tocentry Te; struct cdrom_tocentry Te;
Te.cdte_track=session; Te.cdte_track=session;
Te.cdte_format=CDROM_LBA; Te.cdte_format=CDROM_LBA;
......
...@@ -23,7 +23,8 @@ reiserfs_set_acl(struct inode *inode, struct posix_acl *acl, int type) ...@@ -23,7 +23,8 @@ reiserfs_set_acl(struct inode *inode, struct posix_acl *acl, int type)
struct reiserfs_transaction_handle th; struct reiserfs_transaction_handle th;
size_t jcreate_blocks; size_t jcreate_blocks;
int size = acl ? posix_acl_xattr_size(acl->a_count) : 0; int size = acl ? posix_acl_xattr_size(acl->a_count) : 0;
int update_mode = 0;
umode_t mode = inode->i_mode;
/* /*
* Pessimism: We can't assume that anything from the xattr root up * Pessimism: We can't assume that anything from the xattr root up
...@@ -37,7 +38,16 @@ reiserfs_set_acl(struct inode *inode, struct posix_acl *acl, int type) ...@@ -37,7 +38,16 @@ reiserfs_set_acl(struct inode *inode, struct posix_acl *acl, int type)
error = journal_begin(&th, inode->i_sb, jcreate_blocks); error = journal_begin(&th, inode->i_sb, jcreate_blocks);
reiserfs_write_unlock(inode->i_sb); reiserfs_write_unlock(inode->i_sb);
if (error == 0) { if (error == 0) {
if (type == ACL_TYPE_ACCESS && acl) {
error = posix_acl_update_mode(inode, &mode, &acl);
if (error)
goto unlock;
update_mode = 1;
}
error = __reiserfs_set_acl(&th, inode, type, acl); error = __reiserfs_set_acl(&th, inode, type, acl);
if (!error && update_mode)
inode->i_mode = mode;
unlock:
reiserfs_write_lock(inode->i_sb); reiserfs_write_lock(inode->i_sb);
error2 = journal_end(&th); error2 = journal_end(&th);
reiserfs_write_unlock(inode->i_sb); reiserfs_write_unlock(inode->i_sb);
...@@ -241,11 +251,6 @@ __reiserfs_set_acl(struct reiserfs_transaction_handle *th, struct inode *inode, ...@@ -241,11 +251,6 @@ __reiserfs_set_acl(struct reiserfs_transaction_handle *th, struct inode *inode,
switch (type) { switch (type) {
case ACL_TYPE_ACCESS: case ACL_TYPE_ACCESS:
name = XATTR_NAME_POSIX_ACL_ACCESS; name = XATTR_NAME_POSIX_ACL_ACCESS;
if (acl) {
error = posix_acl_update_mode(inode, &inode->i_mode, &acl);
if (error)
return error;
}
break; break;
case ACL_TYPE_DEFAULT: case ACL_TYPE_DEFAULT:
name = XATTR_NAME_POSIX_ACL_DEFAULT; name = XATTR_NAME_POSIX_ACL_DEFAULT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment