aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ubifs/file.c
diff options
context:
space:
mode:
authorJames Morris <jmorris@namei.org>2009-02-05 19:01:45 -0500
committerJames Morris <jmorris@namei.org>2009-02-05 19:01:45 -0500
commitcb5629b10d64a8006622ce3a52bc887d91057d69 (patch)
tree7c06d8f30783115e3384721046258ce615b129c5 /fs/ubifs/file.c
parent8920d5ad6ba74ae8ab020e90cc4d976980e68701 (diff)
parentf01d1d546abb2f4028b5299092f529eefb01253a (diff)
Merge branch 'master' into next
Conflicts: fs/namei.c Manually merged per: diff --cc fs/namei.c index 734f2b5,bbc15c2..0000000 --- a/fs/namei.c +++ b/fs/namei.c @@@ -860,9 -848,8 +849,10 @@@ static int __link_path_walk(const char nd->flags |= LOOKUP_CONTINUE; err = exec_permission_lite(inode); if (err == -EAGAIN) - err = vfs_permission(nd, MAY_EXEC); + err = inode_permission(nd->path.dentry->d_inode, + MAY_EXEC); + if (!err) + err = ima_path_check(&nd->path, MAY_EXEC); if (err) break; @@@ -1525,14 -1506,9 +1509,14 @@@ int may_open(struct path *path, int acc flag &= ~O_TRUNC; } - error = vfs_permission(nd, acc_mode); + error = inode_permission(inode, acc_mode); if (error) return error; + - error = ima_path_check(&nd->path, ++ error = ima_path_check(path, + acc_mode & (MAY_READ | MAY_WRITE | MAY_EXEC)); + if (error) + return error; /* * An append-only file must be opened in append mode for writing. */ Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'fs/ubifs/file.c')
-rw-r--r--fs/ubifs/file.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
index 2624411d9758..93b6de51f261 100644
--- a/fs/ubifs/file.c
+++ b/fs/ubifs/file.c
@@ -72,8 +72,8 @@ static int read_block(struct inode *inode, void *addr, unsigned int block,
72 return err; 72 return err;
73 } 73 }
74 74
75 ubifs_assert(le64_to_cpu(dn->ch.sqnum) > ubifs_inode(inode)->creat_sqnum); 75 ubifs_assert(le64_to_cpu(dn->ch.sqnum) >
76 76 ubifs_inode(inode)->creat_sqnum);
77 len = le32_to_cpu(dn->size); 77 len = le32_to_cpu(dn->size);
78 if (len <= 0 || len > UBIFS_BLOCK_SIZE) 78 if (len <= 0 || len > UBIFS_BLOCK_SIZE)
79 goto dump; 79 goto dump;
@@ -219,7 +219,8 @@ static void release_existing_page_budget(struct ubifs_info *c)
219} 219}
220 220
221static int write_begin_slow(struct address_space *mapping, 221static int write_begin_slow(struct address_space *mapping,
222 loff_t pos, unsigned len, struct page **pagep) 222 loff_t pos, unsigned len, struct page **pagep,
223 unsigned flags)
223{ 224{
224 struct inode *inode = mapping->host; 225 struct inode *inode = mapping->host;
225 struct ubifs_info *c = inode->i_sb->s_fs_info; 226 struct ubifs_info *c = inode->i_sb->s_fs_info;
@@ -247,14 +248,14 @@ static int write_begin_slow(struct address_space *mapping,
247 if (unlikely(err)) 248 if (unlikely(err))
248 return err; 249 return err;
249 250
250 page = __grab_cache_page(mapping, index); 251 page = grab_cache_page_write_begin(mapping, index, flags);
251 if (unlikely(!page)) { 252 if (unlikely(!page)) {
252 ubifs_release_budget(c, &req); 253 ubifs_release_budget(c, &req);
253 return -ENOMEM; 254 return -ENOMEM;
254 } 255 }
255 256
256 if (!PageUptodate(page)) { 257 if (!PageUptodate(page)) {
257 if (!(pos & PAGE_CACHE_MASK) && len == PAGE_CACHE_SIZE) 258 if (!(pos & ~PAGE_CACHE_MASK) && len == PAGE_CACHE_SIZE)
258 SetPageChecked(page); 259 SetPageChecked(page);
259 else { 260 else {
260 err = do_readpage(page); 261 err = do_readpage(page);
@@ -431,20 +432,19 @@ static int ubifs_write_begin(struct file *file, struct address_space *mapping,
431 int uninitialized_var(err), appending = !!(pos + len > inode->i_size); 432 int uninitialized_var(err), appending = !!(pos + len > inode->i_size);
432 struct page *page; 433 struct page *page;
433 434
434
435 ubifs_assert(ubifs_inode(inode)->ui_size == inode->i_size); 435 ubifs_assert(ubifs_inode(inode)->ui_size == inode->i_size);
436 436
437 if (unlikely(c->ro_media)) 437 if (unlikely(c->ro_media))
438 return -EROFS; 438 return -EROFS;
439 439
440 /* Try out the fast-path part first */ 440 /* Try out the fast-path part first */
441 page = __grab_cache_page(mapping, index); 441 page = grab_cache_page_write_begin(mapping, index, flags);
442 if (unlikely(!page)) 442 if (unlikely(!page))
443 return -ENOMEM; 443 return -ENOMEM;
444 444
445 if (!PageUptodate(page)) { 445 if (!PageUptodate(page)) {
446 /* The page is not loaded from the flash */ 446 /* The page is not loaded from the flash */
447 if (!(pos & PAGE_CACHE_MASK) && len == PAGE_CACHE_SIZE) 447 if (!(pos & ~PAGE_CACHE_MASK) && len == PAGE_CACHE_SIZE)
448 /* 448 /*
449 * We change whole page so no need to load it. But we 449 * We change whole page so no need to load it. But we
450 * have to set the @PG_checked flag to make the further 450 * have to set the @PG_checked flag to make the further
@@ -483,7 +483,7 @@ static int ubifs_write_begin(struct file *file, struct address_space *mapping,
483 unlock_page(page); 483 unlock_page(page);
484 page_cache_release(page); 484 page_cache_release(page);
485 485
486 return write_begin_slow(mapping, pos, len, pagep); 486 return write_begin_slow(mapping, pos, len, pagep, flags);
487 } 487 }
488 488
489 /* 489 /*
@@ -1540,7 +1540,7 @@ static int ubifs_file_mmap(struct file *file, struct vm_area_struct *vma)
1540 return 0; 1540 return 0;
1541} 1541}
1542 1542
1543struct address_space_operations ubifs_file_address_operations = { 1543const struct address_space_operations ubifs_file_address_operations = {
1544 .readpage = ubifs_readpage, 1544 .readpage = ubifs_readpage,
1545 .writepage = ubifs_writepage, 1545 .writepage = ubifs_writepage,
1546 .write_begin = ubifs_write_begin, 1546 .write_begin = ubifs_write_begin,
@@ -1550,7 +1550,7 @@ struct address_space_operations ubifs_file_address_operations = {
1550 .releasepage = ubifs_releasepage, 1550 .releasepage = ubifs_releasepage,
1551}; 1551};
1552 1552
1553struct inode_operations ubifs_file_inode_operations = { 1553const struct inode_operations ubifs_file_inode_operations = {
1554 .setattr = ubifs_setattr, 1554 .setattr = ubifs_setattr,
1555 .getattr = ubifs_getattr, 1555 .getattr = ubifs_getattr,
1556#ifdef CONFIG_UBIFS_FS_XATTR 1556#ifdef CONFIG_UBIFS_FS_XATTR
@@ -1561,14 +1561,14 @@ struct inode_operations ubifs_file_inode_operations = {
1561#endif 1561#endif
1562}; 1562};
1563 1563
1564struct inode_operations ubifs_symlink_inode_operations = { 1564const struct inode_operations ubifs_symlink_inode_operations = {
1565 .readlink = generic_readlink, 1565 .readlink = generic_readlink,
1566 .follow_link = ubifs_follow_link, 1566 .follow_link = ubifs_follow_link,
1567 .setattr = ubifs_setattr, 1567 .setattr = ubifs_setattr,
1568 .getattr = ubifs_getattr, 1568 .getattr = ubifs_getattr,
1569}; 1569};
1570 1570
1571struct file_operations ubifs_file_operations = { 1571const struct file_operations ubifs_file_operations = {
1572 .llseek = generic_file_llseek, 1572 .llseek = generic_file_llseek,
1573 .read = do_sync_read, 1573 .read = do_sync_read,
1574 .write = do_sync_write, 1574 .write = do_sync_write,