Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b8387dee authored by Hridya Valsaraju's avatar Hridya Valsaraju
Browse files

UPSTREAM: 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: default avatarChristian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: default avatarChristian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: default avatarHridya Valsaraju <hridya@google.com>
Reviewed-by: default avatarJoel Fernandes (Google) <joel@joelfernandes.org>
Signed-off-by: default avatarHridya Valsaraju <hridya@google.com>

Bug: 136497735
(cherry picked from commit 028fb5822b76bc2e095b5c145d7bd263878d9e27)
Change-Id: I347a427690ae35c792ce15afc90151937b879ef7
parent 5d46bcfa
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -570,6 +570,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,