Skip to content

Commit 028fb58

Browse files
Hridya Valsarajugregkh
authored andcommitted
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 <christian.brauner@ubuntu.com> Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com> Signed-off-by: Hridya Valsaraju <hridya@google.com> Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org> Link: https://lore.kernel.org/r/20190808222727.132744-3-hridya@google.com Link: https://lore.kernel.org/r/20190904110704.8606-3-christian.brauner@ubuntu.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent c165d89 commit 028fb58

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

‎drivers/android/binderfs.c‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,18 @@ static struct file_system_type binder_fs_type = {
553553
int __init init_binderfs(void)
554554
{
555555
int ret;
556+
const char *name;
557+
size_t len;
558+
559+
/* Verify that the default binderfs device names are valid. */
560+
name = binder_devices_param;
561+
for (len = strcspn(name, ","); len > 0; len = strcspn(name, ",")) {
562+
if (len > BINDERFS_MAX_NAME)
563+
return -E2BIG;
564+
name += len;
565+
if (*name == ',')
566+
name++;
567+
}
556568

557569
/* Allocate new major number for binderfs. */
558570
ret = alloc_chrdev_region(&binderfs_dev, 0, BINDERFS_MAX_MINOR,

0 commit comments

Comments
 (0)