ANDROID: firmware_loader: Restore permissions for firmware class path

Permissions for accessing firmware class path was wrongly set to write only for root
as a result the path can not be read. Restore permissions, so that it can be read.
Add a getter function to read the class path.

Bug: 240542962
Fixes: d551647f3b ("ANDROID: firmware_loader: Add support for customer firmware paths")
Fixes: 87abd99c7f ("ANDROID: firmware_loader: Fix warning with firmware_param_path_set").
Change-Id: I65f434db6a0c31d0b01a5a58cfba0d241e98dd0e
Signed-off-by: Vamsi Krishna Lanka <quic_vamslank@quicinc.com>
This commit is contained in:
Vamsi Krishna Lanka 2022-07-26 15:10:22 -07:00 committed by Treehugger Robot
parent d093524166
commit d20aaea59d
1 changed files with 15 additions and 1 deletions

View File

@ -518,6 +518,19 @@ static int firmware_param_path_set(const char *val, const struct kernel_param *k
return 0;
}
static int firmware_param_path_get(char *buffer, const struct kernel_param *kp)
{
int count = 0, i;
for (i = 0; i < CUSTOM_FW_PATH_COUNT; i++) {
if (strlen(fw_path_para[i]) != 0)
count += scnprintf(buffer + count, PATH_SIZE, "%s%s", fw_path_para[i], ",");
}
buffer[count - 1] = '\0';
return count - 1;
}
/*
* Typical usage is that passing 'firmware_class.path=/vendor,/firwmare_mnt'
* from kernel command line because firmware_class is generally built in
@ -527,8 +540,9 @@ static int firmware_param_path_set(const char *val, const struct kernel_param *k
static const struct kernel_param_ops firmware_param_ops = {
.set = firmware_param_path_set,
.get = firmware_param_path_get,
};
module_param_cb(path, &firmware_param_ops, NULL, 0200);
module_param_cb(path, &firmware_param_ops, NULL, 0644);
MODULE_PARM_DESC(path, "customized firmware image search path with a higher priority than default path");
static int