diff options
Diffstat (limited to 'drivers/android')
| -rw-r--r-- | drivers/android/binder.c | 37 | ||||
| -rw-r--r-- | drivers/android/binder_internal.h | 9 | ||||
| -rw-r--r-- | drivers/android/binderfs.c | 14 |
3 files changed, 41 insertions, 19 deletions
diff --git a/drivers/android/binder.c b/drivers/android/binder.c index cdfc87629efb..4d2b2ad1ee0e 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c | |||
| @@ -5854,9 +5854,10 @@ static int __init init_binder_device(const char *name) | |||
| 5854 | static int __init binder_init(void) | 5854 | static int __init binder_init(void) |
| 5855 | { | 5855 | { |
| 5856 | int ret; | 5856 | int ret; |
| 5857 | char *device_name, *device_names, *device_tmp; | 5857 | char *device_name, *device_tmp; |
| 5858 | struct binder_device *device; | 5858 | struct binder_device *device; |
| 5859 | struct hlist_node *tmp; | 5859 | struct hlist_node *tmp; |
| 5860 | char *device_names = NULL; | ||
| 5860 | 5861 | ||
| 5861 | ret = binder_alloc_shrinker_init(); | 5862 | ret = binder_alloc_shrinker_init(); |
| 5862 | if (ret) | 5863 | if (ret) |
| @@ -5898,23 +5899,29 @@ static int __init binder_init(void) | |||
| 5898 | &transaction_log_fops); | 5899 | &transaction_log_fops); |
| 5899 | } | 5900 | } |
| 5900 | 5901 | ||
| 5901 | /* | 5902 | if (strcmp(binder_devices_param, "") != 0) { |
| 5902 | * Copy the module_parameter string, because we don't want to | 5903 | /* |
| 5903 | * tokenize it in-place. | 5904 | * Copy the module_parameter string, because we don't want to |
| 5904 | */ | 5905 | * tokenize it in-place. |
| 5905 | device_names = kstrdup(binder_devices_param, GFP_KERNEL); | 5906 | */ |
| 5906 | if (!device_names) { | 5907 | device_names = kstrdup(binder_devices_param, GFP_KERNEL); |
| 5907 | ret = -ENOMEM; | 5908 | if (!device_names) { |
| 5908 | goto err_alloc_device_names_failed; | 5909 | ret = -ENOMEM; |
| 5909 | } | 5910 | goto err_alloc_device_names_failed; |
| 5911 | } | ||
| 5910 | 5912 | ||
| 5911 | device_tmp = device_names; | 5913 | device_tmp = device_names; |
| 5912 | while ((device_name = strsep(&device_tmp, ","))) { | 5914 | while ((device_name = strsep(&device_tmp, ","))) { |
| 5913 | ret = init_binder_device(device_name); | 5915 | ret = init_binder_device(device_name); |
| 5914 | if (ret) | 5916 | if (ret) |
| 5915 | goto err_init_binder_device_failed; | 5917 | goto err_init_binder_device_failed; |
| 5918 | } | ||
| 5916 | } | 5919 | } |
| 5917 | 5920 | ||
| 5921 | ret = init_binderfs(); | ||
| 5922 | if (ret) | ||
| 5923 | goto err_init_binder_device_failed; | ||
| 5924 | |||
| 5918 | return ret; | 5925 | return ret; |
| 5919 | 5926 | ||
| 5920 | err_init_binder_device_failed: | 5927 | err_init_binder_device_failed: |
diff --git a/drivers/android/binder_internal.h b/drivers/android/binder_internal.h index 7fb97f503ef2..045b3e42d98b 100644 --- a/drivers/android/binder_internal.h +++ b/drivers/android/binder_internal.h | |||
| @@ -46,4 +46,13 @@ static inline bool is_binderfs_device(const struct inode *inode) | |||
| 46 | } | 46 | } |
| 47 | #endif | 47 | #endif |
| 48 | 48 | ||
| 49 | #ifdef CONFIG_ANDROID_BINDERFS | ||
| 50 | extern int __init init_binderfs(void); | ||
| 51 | #else | ||
| 52 | static inline int __init init_binderfs(void) | ||
| 53 | { | ||
| 54 | return 0; | ||
| 55 | } | ||
| 56 | #endif | ||
| 57 | |||
| 49 | #endif /* _LINUX_BINDER_INTERNAL_H */ | 58 | #endif /* _LINUX_BINDER_INTERNAL_H */ |
diff --git a/drivers/android/binderfs.c b/drivers/android/binderfs.c index 6a2185eb66c5..e773f45d19d9 100644 --- a/drivers/android/binderfs.c +++ b/drivers/android/binderfs.c | |||
| @@ -395,6 +395,11 @@ static int binderfs_binder_ctl_create(struct super_block *sb) | |||
| 395 | struct inode *inode = NULL; | 395 | struct inode *inode = NULL; |
| 396 | struct dentry *root = sb->s_root; | 396 | struct dentry *root = sb->s_root; |
| 397 | struct binderfs_info *info = sb->s_fs_info; | 397 | struct binderfs_info *info = sb->s_fs_info; |
| 398 | #if defined(CONFIG_IPC_NS) | ||
| 399 | bool use_reserve = (info->ipc_ns == &init_ipc_ns); | ||
| 400 | #else | ||
| 401 | bool use_reserve = true; | ||
| 402 | #endif | ||
| 398 | 403 | ||
| 399 | device = kzalloc(sizeof(*device), GFP_KERNEL); | 404 | device = kzalloc(sizeof(*device), GFP_KERNEL); |
| 400 | if (!device) | 405 | if (!device) |
| @@ -413,7 +418,10 @@ static int binderfs_binder_ctl_create(struct super_block *sb) | |||
| 413 | 418 | ||
| 414 | /* Reserve a new minor number for the new device. */ | 419 | /* Reserve a new minor number for the new device. */ |
| 415 | mutex_lock(&binderfs_minors_mutex); | 420 | mutex_lock(&binderfs_minors_mutex); |
| 416 | minor = ida_alloc_max(&binderfs_minors, BINDERFS_MAX_MINOR, GFP_KERNEL); | 421 | minor = ida_alloc_max(&binderfs_minors, |
| 422 | use_reserve ? BINDERFS_MAX_MINOR : | ||
| 423 | BINDERFS_MAX_MINOR_CAPPED, | ||
| 424 | GFP_KERNEL); | ||
| 417 | mutex_unlock(&binderfs_minors_mutex); | 425 | mutex_unlock(&binderfs_minors_mutex); |
| 418 | if (minor < 0) { | 426 | if (minor < 0) { |
| 419 | ret = minor; | 427 | ret = minor; |
| @@ -542,7 +550,7 @@ static struct file_system_type binder_fs_type = { | |||
| 542 | .fs_flags = FS_USERNS_MOUNT, | 550 | .fs_flags = FS_USERNS_MOUNT, |
| 543 | }; | 551 | }; |
| 544 | 552 | ||
| 545 | static int __init init_binderfs(void) | 553 | int __init init_binderfs(void) |
| 546 | { | 554 | { |
| 547 | int ret; | 555 | int ret; |
| 548 | 556 | ||
| @@ -560,5 +568,3 @@ static int __init init_binderfs(void) | |||
| 560 | 568 | ||
| 561 | return ret; | 569 | return ret; |
| 562 | } | 570 | } |
| 563 | |||
| 564 | device_initcall(init_binderfs); | ||
