Unverified Commit ebcff945 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!14267 backport LTS commits

Merge Pull Request from: @ci-robot 
 
PR sync from: Qi Xi <xiqi2@huawei.com>
https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/ECM5EC5NJOZGOG2NLFQ6EZLANUM3RDDY/ 
*** BLURB HERE ***

Aleksandr Mishin (1):
  ACPI: PMIC: Remove unneeded check in tps68470_pmic_opregion_probe()

Aleksandrs Vinarskis (1):
  ACPICA: iasl: handle empty connection_node

Armin Wolf (3):
  ACPICA: Fix memory leak if acpi_ps_get_next_namepath() fails
  ACPICA: Fix memory leak if acpi_ps_get_next_field() fails
  ACPI: battery: Simplify battery hook locking

Michael Kelley (1):
  x86/hyperv: Set X86_FEATURE_TSC_KNOWN_FREQ when Hyper-V provides
    frequency

Pei Xiao (1):
  ACPICA: check null return of ACPI_ALLOCATE_ZEROED() in
    acpi_db_convert_to_package()

Rafael J. Wysocki (1):
  ACPI: EC: Do not release locks during operation region accesses


-- 
2.33.0
 
https://gitee.com/openeuler/kernel/issues/IBBN6V 
 
Link:https://gitee.com/openeuler/kernel/pulls/14267

 

Reviewed-by: default avatarXiongfeng Wang <wangxiongfeng2@huawei.com>
Reviewed-by: default avatarYuan Can <yuancan@huawei.com>
Signed-off-by: default avatarYuan Can <yuancan@huawei.com>
parents 765b1322 e4a44b89
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -243,6 +243,7 @@ static void __init ms_hyperv_init_platform(void)
	    ms_hyperv.misc_features & HV_FEATURE_FREQUENCY_MSRS_AVAILABLE) {
		x86_platform.calibrate_tsc = hv_get_tsc_khz;
		x86_platform.calibrate_cpu = hv_get_tsc_khz;
		setup_force_cpu_cap(X86_FEATURE_TSC_KNOWN_FREQ);
	}

	if (ms_hyperv.hints & HV_X64_ENLIGHTENED_VMCS_RECOMMENDED) {
+2 −0
Original line number Diff line number Diff line
@@ -170,6 +170,8 @@ acpi_status acpi_db_convert_to_package(char *string, union acpi_object *object)
	elements =
	    ACPI_ALLOCATE_ZEROED(DB_DEFAULT_PKG_ELEMENTS *
				 sizeof(union acpi_object));
	if (!elements)
		return (AE_NO_MEMORY);

	this = string;
	for (i = 0; i < (DB_DEFAULT_PKG_ELEMENTS - 1); i++) {
+3 −0
Original line number Diff line number Diff line
@@ -437,6 +437,9 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info)

		if (info->connection_node) {
			second_desc = info->connection_node->object;
			if (second_desc == NULL) {
				break;
			}
			if (!(second_desc->common.flags & AOPOBJ_DATA_VALID)) {
				status =
				    acpi_ds_get_buffer_arguments(second_desc);
+47 −0
Original line number Diff line number Diff line
@@ -25,6 +25,8 @@ acpi_ps_get_next_package_length(struct acpi_parse_state *parser_state);
static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state
						       *parser_state);

static void acpi_ps_free_field_list(union acpi_parse_object *start);

/*******************************************************************************
 *
 * FUNCTION:    acpi_ps_get_next_package_length
@@ -683,6 +685,39 @@ static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state
	return_PTR(field);
}

/*******************************************************************************
 *
 * FUNCTION:    acpi_ps_free_field_list
 *
 * PARAMETERS:  start               - First Op in field list
 *
 * RETURN:      None.
 *
 * DESCRIPTION: Free all Op objects inside a field list.
 *
 ******************************************************************************/

static void acpi_ps_free_field_list(union acpi_parse_object *start)
{
	union acpi_parse_object *cur = start;
	union acpi_parse_object *next;
	union acpi_parse_object *arg;

	while (cur) {
		next = cur->common.next;

		/* AML_INT_CONNECTION_OP can have a single argument */

		arg = acpi_ps_get_arg(cur, 0);
		if (arg) {
			acpi_ps_free_op(arg);
		}

		acpi_ps_free_op(cur);
		cur = next;
	}
}

/*******************************************************************************
 *
 * FUNCTION:    acpi_ps_get_next_arg
@@ -751,6 +786,10 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state,
			while (parser_state->aml < parser_state->pkg_end) {
				field = acpi_ps_get_next_field(parser_state);
				if (!field) {
					if (arg) {
						acpi_ps_free_field_list(arg);
					}

					return_ACPI_STATUS(AE_NO_MEMORY);
				}

@@ -820,6 +859,10 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state,
			    acpi_ps_get_next_namepath(walk_state, parser_state,
						      arg,
						      ACPI_NOT_METHOD_CALL);
			if (ACPI_FAILURE(status)) {
				acpi_ps_free_op(arg);
				return_ACPI_STATUS(status);
			}
		} else {
			/* Single complex argument, nothing returned */

@@ -854,6 +897,10 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state,
			    acpi_ps_get_next_namepath(walk_state, parser_state,
						      arg,
						      ACPI_POSSIBLE_METHOD_CALL);
			if (ACPI_FAILURE(status)) {
				acpi_ps_free_op(arg);
				return_ACPI_STATUS(status);
			}

			if (arg->common.aml_opcode == AML_INT_METHODCALL_OP) {

+9 −9
Original line number Diff line number Diff line
@@ -683,27 +683,27 @@ static LIST_HEAD(acpi_battery_list);
static LIST_HEAD(battery_hook_list);
static DEFINE_MUTEX(hook_mutex);

static void __battery_hook_unregister(struct acpi_battery_hook *hook, int lock)
static void battery_hook_unregister_unlocked(struct acpi_battery_hook *hook)
{
	struct acpi_battery *battery;

	/*
	 * In order to remove a hook, we first need to
	 * de-register all the batteries that are registered.
	 */
	if (lock)
		mutex_lock(&hook_mutex);
	list_for_each_entry(battery, &acpi_battery_list, list) {
		hook->remove_battery(battery->bat);
	}
	list_del(&hook->list);
	if (lock)
		mutex_unlock(&hook_mutex);

	pr_info("extension unregistered: %s\n", hook->name);
}

void battery_hook_unregister(struct acpi_battery_hook *hook)
{
	__battery_hook_unregister(hook, 1);
	mutex_lock(&hook_mutex);
	battery_hook_unregister_unlocked(hook);
	mutex_unlock(&hook_mutex);
}
EXPORT_SYMBOL_GPL(battery_hook_unregister);

@@ -729,7 +729,7 @@ void battery_hook_register(struct acpi_battery_hook *hook)
			 * hooks.
			 */
			pr_err("extension failed to load: %s", hook->name);
			__battery_hook_unregister(hook, 0);
			battery_hook_unregister_unlocked(hook);
			goto end;
		}
	}
@@ -766,7 +766,7 @@ static void battery_hook_add_battery(struct acpi_battery *battery)
			 */
			pr_err("error in extension, unloading: %s",
					hook_node->name);
			__battery_hook_unregister(hook_node, 0);
			battery_hook_unregister_unlocked(hook_node);
		}
	}
	mutex_unlock(&hook_mutex);
@@ -799,7 +799,7 @@ static void __exit battery_hook_exit(void)
	 * need to remove the hooks.
	 */
	list_for_each_entry_safe(hook, ptr, &battery_hook_list, list) {
		__battery_hook_unregister(hook, 1);
		battery_hook_unregister(hook);
	}
	mutex_destroy(&hook_mutex);
}
Loading