diff options
Diffstat (limited to 'drivers/android')
| -rw-r--r-- | drivers/android/binderfs.c | 41 |
1 files changed, 11 insertions, 30 deletions
diff --git a/drivers/android/binderfs.c b/drivers/android/binderfs.c index e73f9dbee099..89a2ee1a02f6 100644 --- a/drivers/android/binderfs.c +++ b/drivers/android/binderfs.c | |||
| @@ -461,12 +461,9 @@ static const struct inode_operations binderfs_dir_inode_operations = { | |||
| 461 | 461 | ||
| 462 | static int binderfs_fill_super(struct super_block *sb, void *data, int silent) | 462 | static int binderfs_fill_super(struct super_block *sb, void *data, int silent) |
| 463 | { | 463 | { |
| 464 | int ret; | ||
| 464 | struct binderfs_info *info; | 465 | struct binderfs_info *info; |
| 465 | int ret = -ENOMEM; | ||
| 466 | struct inode *inode = NULL; | 466 | struct inode *inode = NULL; |
| 467 | struct ipc_namespace *ipc_ns = current->nsproxy->ipc_ns; | ||
| 468 | |||
| 469 | get_ipc_ns(ipc_ns); | ||
| 470 | 467 | ||
| 471 | sb->s_blocksize = PAGE_SIZE; | 468 | sb->s_blocksize = PAGE_SIZE; |
| 472 | sb->s_blocksize_bits = PAGE_SHIFT; | 469 | sb->s_blocksize_bits = PAGE_SHIFT; |
| @@ -488,15 +485,17 @@ static int binderfs_fill_super(struct super_block *sb, void *data, int silent) | |||
| 488 | sb->s_op = &binderfs_super_ops; | 485 | sb->s_op = &binderfs_super_ops; |
| 489 | sb->s_time_gran = 1; | 486 | sb->s_time_gran = 1; |
| 490 | 487 | ||
| 491 | info = kzalloc(sizeof(struct binderfs_info), GFP_KERNEL); | 488 | sb->s_fs_info = kzalloc(sizeof(struct binderfs_info), GFP_KERNEL); |
| 492 | if (!info) | 489 | if (!sb->s_fs_info) |
| 493 | goto err_without_dentry; | 490 | return -ENOMEM; |
| 491 | info = sb->s_fs_info; | ||
| 492 | |||
| 493 | info->ipc_ns = get_ipc_ns(current->nsproxy->ipc_ns); | ||
| 494 | 494 | ||
| 495 | ret = binderfs_parse_mount_opts(data, &info->mount_opts); | 495 | ret = binderfs_parse_mount_opts(data, &info->mount_opts); |
| 496 | if (ret) | 496 | if (ret) |
| 497 | goto err_without_dentry; | 497 | return ret; |
| 498 | 498 | ||
| 499 | info->ipc_ns = ipc_ns; | ||
| 500 | info->root_gid = make_kgid(sb->s_user_ns, 0); | 499 | info->root_gid = make_kgid(sb->s_user_ns, 0); |
| 501 | if (!gid_valid(info->root_gid)) | 500 | if (!gid_valid(info->root_gid)) |
| 502 | info->root_gid = GLOBAL_ROOT_GID; | 501 | info->root_gid = GLOBAL_ROOT_GID; |
| @@ -504,12 +503,9 @@ static int binderfs_fill_super(struct super_block *sb, void *data, int silent) | |||
| 504 | if (!uid_valid(info->root_uid)) | 503 | if (!uid_valid(info->root_uid)) |
| 505 | info->root_uid = GLOBAL_ROOT_UID; | 504 | info->root_uid = GLOBAL_ROOT_UID; |
| 506 | 505 | ||
| 507 | sb->s_fs_info = info; | ||
| 508 | |||
| 509 | ret = -ENOMEM; | ||
| 510 | inode = new_inode(sb); | 506 | inode = new_inode(sb); |
| 511 | if (!inode) | 507 | if (!inode) |
| 512 | goto err_without_dentry; | 508 | return -ENOMEM; |
| 513 | 509 | ||
| 514 | inode->i_ino = FIRST_INODE; | 510 | inode->i_ino = FIRST_INODE; |
| 515 | inode->i_fop = &simple_dir_operations; | 511 | inode->i_fop = &simple_dir_operations; |
| @@ -520,24 +516,9 @@ static int binderfs_fill_super(struct super_block *sb, void *data, int silent) | |||
| 520 | 516 | ||
| 521 | sb->s_root = d_make_root(inode); | 517 | sb->s_root = d_make_root(inode); |
| 522 | if (!sb->s_root) | 518 | if (!sb->s_root) |
| 523 | goto err_without_dentry; | 519 | return -ENOMEM; |
| 524 | |||
| 525 | ret = binderfs_binder_ctl_create(sb); | ||
| 526 | if (ret) | ||
| 527 | goto err_with_dentry; | ||
| 528 | |||
| 529 | return 0; | ||
| 530 | |||
| 531 | err_with_dentry: | ||
| 532 | dput(sb->s_root); | ||
| 533 | sb->s_root = NULL; | ||
| 534 | |||
| 535 | err_without_dentry: | ||
| 536 | put_ipc_ns(ipc_ns); | ||
| 537 | iput(inode); | ||
| 538 | kfree(info); | ||
| 539 | 520 | ||
| 540 | return ret; | 521 | return binderfs_binder_ctl_create(sb); |
| 541 | } | 522 | } |
| 542 | 523 | ||
| 543 | static struct dentry *binderfs_mount(struct file_system_type *fs_type, | 524 | static struct dentry *binderfs_mount(struct file_system_type *fs_type, |
