Skip to content

Commit f70e1e7

Browse files
committed
Merge tag 'acpi-6.17-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull ACPI fixes from Rafael Wysocki: "These fix three new issues in the ACPI APEI error injection code and an ACPI platform firmware runtime update interface issue: - Make ACPI APEI error injection check the version of the request when mapping the EINJ parameter structure in the BIOS reserved memory to prevent injecting errors based on an uninitialized field (Tony Luck) - Fix potential NULL dereference in __einj_error_inject() that may occur when memory allocation fails (Charles Han) - Remove the __exit annotation from einj_remove(), so it can be called on errors during faux device probe (Uwe Kleine-König) - Use a security-version-number check instead of a runtime version check during ACPI platform firmware runtime driver updates to prevent those updates from failing due to false-positive driver version check failures (Chen Yu)" * tag 'acpi-6.17-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: ACPI: pfr_update: Fix the driver update version check ACPI: APEI: EINJ: Fix resource leak by remove callback in .exit.text ACPI: APEI: EINJ: fix potential NULL dereference in __einj_error_inject() ACPI: APEI: EINJ: Check if user asked for EINJV2 injection
2 parents 26d6ed4 + 670b511 commit f70e1e7

3 files changed

Lines changed: 9 additions & 11 deletions

File tree

drivers/acpi/apei/einj-core.c

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ static void __iomem *einj_get_parameter_address(void)
315315
memcpy_fromio(&v5param, p, v5param_size);
316316
acpi5 = 1;
317317
check_vendor_extension(pa_v5, &v5param);
318-
if (available_error_type & ACPI65_EINJV2_SUPP) {
318+
if (is_v2 && available_error_type & ACPI65_EINJV2_SUPP) {
319319
len = v5param.einjv2_struct.length;
320320
offset = offsetof(struct einjv2_extension_struct, component_arr);
321321
max_nr_components = (len - offset) /
@@ -540,6 +540,9 @@ static int __einj_error_inject(u32 type, u32 flags, u64 param1, u64 param2,
540540
struct set_error_type_with_address *v5param;
541541

542542
v5param = kmalloc(v5param_size, GFP_KERNEL);
543+
if (!v5param)
544+
return -ENOMEM;
545+
543546
memcpy_fromio(v5param, einj_param, v5param_size);
544547
v5param->type = type;
545548
if (type & ACPI5_VENDOR_BIT) {
@@ -1091,7 +1094,7 @@ static int __init einj_probe(struct faux_device *fdev)
10911094
return rc;
10921095
}
10931096

1094-
static void __exit einj_remove(struct faux_device *fdev)
1097+
static void einj_remove(struct faux_device *fdev)
10951098
{
10961099
struct apei_exec_context ctx;
10971100

@@ -1114,15 +1117,9 @@ static void __exit einj_remove(struct faux_device *fdev)
11141117
}
11151118

11161119
static struct faux_device *einj_dev;
1117-
/*
1118-
* einj_remove() lives in .exit.text. For drivers registered via
1119-
* platform_driver_probe() this is ok because they cannot get unbound at
1120-
* runtime. So mark the driver struct with __refdata to prevent modpost
1121-
* triggering a section mismatch warning.
1122-
*/
1123-
static struct faux_device_ops einj_device_ops __refdata = {
1120+
static struct faux_device_ops einj_device_ops = {
11241121
.probe = einj_probe,
1125-
.remove = __exit_p(einj_remove),
1122+
.remove = einj_remove,
11261123
};
11271124

11281125
static int __init einj_init(void)

drivers/acpi/pfr_update.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ static bool applicable_image(const void *data, struct pfru_update_cap_info *cap,
329329
if (type == PFRU_CODE_INJECT_TYPE)
330330
return payload_hdr->rt_ver >= cap->code_rt_version;
331331

332-
return payload_hdr->rt_ver >= cap->drv_rt_version;
332+
return payload_hdr->svn_ver >= cap->drv_svn;
333333
}
334334

335335
static void print_update_debug_info(struct pfru_updated_result *result,

include/uapi/linux/pfrut.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ struct pfru_payload_hdr {
8989
__u32 hw_ver;
9090
__u32 rt_ver;
9191
__u8 platform_id[16];
92+
__u32 svn_ver;
9293
};
9394

9495
enum pfru_dsm_status {

0 commit comments

Comments
 (0)