aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHridya Valsaraju <[email protected]>2019-09-04 13:07:04 +0200
committerGreg Kroah-Hartman <[email protected]>2019-09-04 13:17:35 +0200
commit028fb5822b76bc2e095b5c145d7bd263878d9e27 (patch)
treed9fb6b0bd85dd276d16a28769c3b9d4da226b2e3
parentc165d8947bc41ebd3b0de3f520490cffb627af90 (diff)
binder: Validate the default binderfs device names.
Length of a binderfs device name cannot exceed BINDERFS_MAX_NAME. This patch adds a check in binderfs_init() to ensure the same for the default binder devices that will be created in every binderfs instance. Co-developed-by: Christian Brauner <[email protected]> Signed-off-by: Christian Brauner <[email protected]> Signed-off-by: Hridya Valsaraju <[email protected]> Reviewed-by: Joel Fernandes (Google) <[email protected]> Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
-rw-r--r--drivers/android/binderfs.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/android/binderfs.c b/drivers/android/binderfs.c
index e773f45d19d9..d8307cccbef8 100644
--- a/drivers/android/binderfs.c
+++ b/drivers/android/binderfs.c
@@ -553,6 +553,18 @@ static struct file_system_type binder_fs_type = {
int __init init_binderfs(void)
{
int ret;
+ const char *name;
+ size_t len;
+
+ /* Verify that the default binderfs device names are valid. */
+ name = binder_devices_param;
+ for (len = strcspn(name, ","); len > 0; len = strcspn(name, ",")) {
+ if (len > BINDERFS_MAX_NAME)
+ return -E2BIG;
+ name += len;
+ if (*name == ',')
+ name++;
+ }
/* Allocate new major number for binderfs. */
ret = alloc_chrdev_region(&binderfs_dev, 0, BINDERFS_MAX_MINOR,