.. | .. |
---|
17 | 17 | #include <linux/cred.h> |
---|
18 | 18 | #include <linux/uio.h> |
---|
19 | 19 | #include <linux/xattr.h> |
---|
| 20 | +#include <linux/blkdev.h> |
---|
20 | 21 | |
---|
21 | 22 | #include "hfs_fs.h" |
---|
22 | 23 | #include "btree.h" |
---|
.. | .. |
---|
351 | 352 | inode->i_mode &= ~hsb->s_file_umask; |
---|
352 | 353 | inode->i_mode |= S_IFREG; |
---|
353 | 354 | inode->i_ctime = inode->i_atime = inode->i_mtime = |
---|
354 | | - timespec_to_timespec64(hfs_m_to_utime(rec->file.MdDat)); |
---|
| 355 | + hfs_m_to_utime(rec->file.MdDat); |
---|
355 | 356 | inode->i_op = &hfs_file_inode_operations; |
---|
356 | 357 | inode->i_fop = &hfs_file_operations; |
---|
357 | 358 | inode->i_mapping->a_ops = &hfs_aops; |
---|
.. | .. |
---|
362 | 363 | HFS_I(inode)->fs_blocks = 0; |
---|
363 | 364 | inode->i_mode = S_IFDIR | (S_IRWXUGO & ~hsb->s_dir_umask); |
---|
364 | 365 | inode->i_ctime = inode->i_atime = inode->i_mtime = |
---|
365 | | - timespec_to_timespec64(hfs_m_to_utime(rec->dir.MdDat)); |
---|
| 366 | + hfs_m_to_utime(rec->dir.MdDat); |
---|
366 | 367 | inode->i_op = &hfs_dir_inode_operations; |
---|
367 | 368 | inode->i_fop = &hfs_dir_operations; |
---|
368 | 369 | break; |
---|
.. | .. |
---|
453 | 454 | /* panic? */ |
---|
454 | 455 | return -EIO; |
---|
455 | 456 | |
---|
| 457 | + res = -EIO; |
---|
| 458 | + if (HFS_I(main_inode)->cat_key.CName.len > HFS_NAMELEN) |
---|
| 459 | + goto out; |
---|
456 | 460 | fd.search_key->cat = HFS_I(main_inode)->cat_key; |
---|
457 | 461 | if (hfs_brec_find(&fd)) |
---|
458 | | - /* panic? */ |
---|
459 | 462 | goto out; |
---|
460 | 463 | |
---|
461 | 464 | if (S_ISDIR(main_inode->i_mode)) { |
---|
462 | 465 | if (fd.entrylength < sizeof(struct hfs_cat_dir)) |
---|
463 | | - /* panic? */; |
---|
| 466 | + goto out; |
---|
464 | 467 | hfs_bnode_read(fd.bnode, &rec, fd.entryoffset, |
---|
465 | 468 | sizeof(struct hfs_cat_dir)); |
---|
466 | 469 | if (rec.type != HFS_CDR_DIR || |
---|
.. | .. |
---|
473 | 476 | hfs_bnode_write(fd.bnode, &rec, fd.entryoffset, |
---|
474 | 477 | sizeof(struct hfs_cat_dir)); |
---|
475 | 478 | } else if (HFS_IS_RSRC(inode)) { |
---|
| 479 | + if (fd.entrylength < sizeof(struct hfs_cat_file)) |
---|
| 480 | + goto out; |
---|
476 | 481 | hfs_bnode_read(fd.bnode, &rec, fd.entryoffset, |
---|
477 | 482 | sizeof(struct hfs_cat_file)); |
---|
478 | 483 | hfs_inode_write_fork(inode, rec.file.RExtRec, |
---|
.. | .. |
---|
481 | 486 | sizeof(struct hfs_cat_file)); |
---|
482 | 487 | } else { |
---|
483 | 488 | if (fd.entrylength < sizeof(struct hfs_cat_file)) |
---|
484 | | - /* panic? */; |
---|
| 489 | + goto out; |
---|
485 | 490 | hfs_bnode_read(fd.bnode, &rec, fd.entryoffset, |
---|
486 | 491 | sizeof(struct hfs_cat_file)); |
---|
487 | 492 | if (rec.type != HFS_CDR_FIL || |
---|
.. | .. |
---|
498 | 503 | hfs_bnode_write(fd.bnode, &rec, fd.entryoffset, |
---|
499 | 504 | sizeof(struct hfs_cat_file)); |
---|
500 | 505 | } |
---|
| 506 | + res = 0; |
---|
501 | 507 | out: |
---|
502 | 508 | hfs_find_exit(&fd); |
---|
503 | | - return 0; |
---|
| 509 | + return res; |
---|
504 | 510 | } |
---|
505 | 511 | |
---|
506 | 512 | static struct dentry *hfs_file_lookup(struct inode *dir, struct dentry *dentry, |
---|