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

* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-udf-2.6:
  udf: add speciffic ->setattr callback
  udf: potential integer overflow
This commit is contained in:
Linus Torvalds 2010-04-12 18:36:34 -07:00
commit 50fc88cb03
5 changed files with 16 additions and 10 deletions

View File

@ -125,9 +125,8 @@ static void udf_bitmap_free_blocks(struct super_block *sb,
mutex_lock(&sbi->s_alloc_mutex); mutex_lock(&sbi->s_alloc_mutex);
partmap = &sbi->s_partmaps[bloc->partitionReferenceNum]; partmap = &sbi->s_partmaps[bloc->partitionReferenceNum];
if (bloc->logicalBlockNum < 0 || if (bloc->logicalBlockNum + count < count ||
(bloc->logicalBlockNum + count) > (bloc->logicalBlockNum + count) > partmap->s_partition_len) {
partmap->s_partition_len) {
udf_debug("%d < %d || %d + %d > %d\n", udf_debug("%d < %d || %d + %d > %d\n",
bloc->logicalBlockNum, 0, bloc->logicalBlockNum, bloc->logicalBlockNum, 0, bloc->logicalBlockNum,
count, partmap->s_partition_len); count, partmap->s_partition_len);
@ -393,9 +392,8 @@ static void udf_table_free_blocks(struct super_block *sb,
mutex_lock(&sbi->s_alloc_mutex); mutex_lock(&sbi->s_alloc_mutex);
partmap = &sbi->s_partmaps[bloc->partitionReferenceNum]; partmap = &sbi->s_partmaps[bloc->partitionReferenceNum];
if (bloc->logicalBlockNum < 0 || if (bloc->logicalBlockNum + count < count ||
(bloc->logicalBlockNum + count) > (bloc->logicalBlockNum + count) > partmap->s_partition_len) {
partmap->s_partition_len) {
udf_debug("%d < %d || %d + %d > %d\n", udf_debug("%d < %d || %d + %d > %d\n",
bloc->logicalBlockNum, 0, bloc->logicalBlockNum, count, bloc->logicalBlockNum, 0, bloc->logicalBlockNum, count,
partmap->s_partition_len); partmap->s_partition_len);

View File

@ -218,7 +218,7 @@ const struct file_operations udf_file_operations = {
.llseek = generic_file_llseek, .llseek = generic_file_llseek,
}; };
static int udf_setattr(struct dentry *dentry, struct iattr *iattr) int udf_setattr(struct dentry *dentry, struct iattr *iattr)
{ {
struct inode *inode = dentry->d_inode; struct inode *inode = dentry->d_inode;
int error; int error;

View File

@ -1314,7 +1314,7 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh)
break; break;
case ICBTAG_FILE_TYPE_SYMLINK: case ICBTAG_FILE_TYPE_SYMLINK:
inode->i_data.a_ops = &udf_symlink_aops; inode->i_data.a_ops = &udf_symlink_aops;
inode->i_op = &page_symlink_inode_operations; inode->i_op = &udf_symlink_inode_operations;
inode->i_mode = S_IFLNK | S_IRWXUGO; inode->i_mode = S_IFLNK | S_IRWXUGO;
break; break;
case ICBTAG_FILE_TYPE_MAIN: case ICBTAG_FILE_TYPE_MAIN:

View File

@ -925,7 +925,7 @@ static int udf_symlink(struct inode *dir, struct dentry *dentry,
iinfo = UDF_I(inode); iinfo = UDF_I(inode);
inode->i_mode = S_IFLNK | S_IRWXUGO; inode->i_mode = S_IFLNK | S_IRWXUGO;
inode->i_data.a_ops = &udf_symlink_aops; inode->i_data.a_ops = &udf_symlink_aops;
inode->i_op = &page_symlink_inode_operations; inode->i_op = &udf_symlink_inode_operations;
if (iinfo->i_alloc_type != ICBTAG_FLAG_AD_IN_ICB) { if (iinfo->i_alloc_type != ICBTAG_FLAG_AD_IN_ICB) {
struct kernel_lb_addr eloc; struct kernel_lb_addr eloc;
@ -1393,6 +1393,7 @@ const struct export_operations udf_export_ops = {
const struct inode_operations udf_dir_inode_operations = { const struct inode_operations udf_dir_inode_operations = {
.lookup = udf_lookup, .lookup = udf_lookup,
.create = udf_create, .create = udf_create,
.setattr = udf_setattr,
.link = udf_link, .link = udf_link,
.unlink = udf_unlink, .unlink = udf_unlink,
.symlink = udf_symlink, .symlink = udf_symlink,
@ -1401,3 +1402,9 @@ const struct inode_operations udf_dir_inode_operations = {
.mknod = udf_mknod, .mknod = udf_mknod,
.rename = udf_rename, .rename = udf_rename,
}; };
const struct inode_operations udf_symlink_inode_operations = {
.readlink = generic_readlink,
.follow_link = page_follow_link_light,
.put_link = page_put_link,
.setattr = udf_setattr,
};

View File

@ -76,6 +76,7 @@ extern const struct inode_operations udf_dir_inode_operations;
extern const struct file_operations udf_dir_operations; extern const struct file_operations udf_dir_operations;
extern const struct inode_operations udf_file_inode_operations; extern const struct inode_operations udf_file_inode_operations;
extern const struct file_operations udf_file_operations; extern const struct file_operations udf_file_operations;
extern const struct inode_operations udf_symlink_inode_operations;
extern const struct address_space_operations udf_aops; extern const struct address_space_operations udf_aops;
extern const struct address_space_operations udf_adinicb_aops; extern const struct address_space_operations udf_adinicb_aops;
extern const struct address_space_operations udf_symlink_aops; extern const struct address_space_operations udf_symlink_aops;
@ -131,7 +132,7 @@ extern int udf_write_fi(struct inode *inode, struct fileIdentDesc *,
/* file.c */ /* file.c */
extern int udf_ioctl(struct inode *, struct file *, unsigned int, extern int udf_ioctl(struct inode *, struct file *, unsigned int,
unsigned long); unsigned long);
extern int udf_setattr(struct dentry *dentry, struct iattr *iattr);
/* inode.c */ /* inode.c */
extern struct inode *udf_iget(struct super_block *, struct kernel_lb_addr *); extern struct inode *udf_iget(struct super_block *, struct kernel_lb_addr *);
extern int udf_sync_inode(struct inode *); extern int udf_sync_inode(struct inode *);