Commit 1457892
ACPI: video: Fix random crashes due to bad kfree()
Commit c6a8370 ("drm/amd/display: Fetch the EDID from _DDC if
available for eDP") added function dm_helpers_probe_acpi_edid(), which
fetches the EDID from the BIOS by calling acpi_video_get_edid().
acpi_video_get_edid() returns a pointer to the EDID, but this pointer
does not originate from kmalloc() - it is actually the internal
"pointer" field from an acpi_buffer struct (which did come from
kmalloc()).
dm_helpers_probe_acpi_edid() then attempts to kfree() the EDID pointer,
resulting in memory corruption which leads to random, intermittent
crashes (e.g. 4% of boots will fail with some Oops).
Fix this by allocating a new array (which can be safely freed) for the
EDID data, and correctly freeing the acpi_buffer pointer.
The only other caller of acpi_video_get_edid() is nouveau_acpi_edid():
remove the extraneous kmemdup() here as the EDID data is now copied in
acpi_video_device_EDID().
Signed-off-by: Chris Bainbridge <chris.bainbridge@gmail.com>
Fixes: c6a8370 ("drm/amd/display: Fetch the EDID from _DDC if available for eDP")
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Reported-by: Borislav Petkov (AMD) <bp@alien8.de>
Tested-by: Borislav Petkov (AMD) <bp@alien8.de>
Closes: https://lore.kernel.org/amd-gfx/20250110175252.GBZ4FedNKqmBRaY4T3@fat_crate.local/T/#m324a23eb4c4c32fa7e89e31f8ba96c781e496fb1
Link: https://patch.msgid.link/Z4K_oQL7eA9Owkbs@debian.local
[ rjw: Changed function description comment into a kerneldoc one ]
[ rjw: Subject and changelog edits ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>1 parent 5bc55a3 commit 1457892
2 files changed
+28
-23
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
610 | 610 | | |
611 | 611 | | |
612 | 612 | | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
613 | 626 | | |
614 | | - | |
615 | | - | |
| 627 | + | |
616 | 628 | | |
617 | | - | |
| 629 | + | |
618 | 630 | | |
619 | 631 | | |
620 | 632 | | |
621 | 633 | | |
622 | | - | |
| 634 | + | |
623 | 635 | | |
624 | 636 | | |
625 | 637 | | |
| |||
636 | 648 | | |
637 | 649 | | |
638 | 650 | | |
639 | | - | |
640 | | - | |
641 | | - | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
642 | 655 | | |
643 | 656 | | |
644 | | - | |
645 | | - | |
| 657 | + | |
646 | 658 | | |
647 | 659 | | |
648 | | - | |
| 660 | + | |
| 661 | + | |
649 | 662 | | |
650 | 663 | | |
651 | 664 | | |
| |||
1435 | 1448 | | |
1436 | 1449 | | |
1437 | 1450 | | |
1438 | | - | |
1439 | | - | |
1440 | | - | |
| 1451 | + | |
1441 | 1452 | | |
1442 | 1453 | | |
1443 | 1454 | | |
| |||
1477 | 1488 | | |
1478 | 1489 | | |
1479 | 1490 | | |
1480 | | - | |
1481 | | - | |
1482 | | - | |
1483 | | - | |
| 1491 | + | |
| 1492 | + | |
| 1493 | + | |
1484 | 1494 | | |
1485 | | - | |
1486 | | - | |
1487 | | - | |
1488 | | - | |
1489 | | - | |
1490 | 1495 | | |
1491 | 1496 | | |
1492 | 1497 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
384 | 384 | | |
385 | 385 | | |
386 | 386 | | |
387 | | - | |
| 387 | + | |
388 | 388 | | |
389 | 389 | | |
390 | 390 | | |
| |||
0 commit comments