Commit 8fa1981
Xiang Liu
drm/amd/ras: Fix CPER ring debugfs read overflow
The legacy CPER debugfs reader can reach the payload path without a
valid pointer snapshot. The remaining user byte count is also treated as
the ring occupancy in dwords, so reads past the header can copy more than
requested.
Take the CPER lock before sampling pointers. Resample rptr/wptr for
payload reads, bound the payload copy by available dwords and the
remaining user size, and advance the file position for each dword copied.
Signed-off-by: Xiang Liu <xiang.liu@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>1 parent bf899db commit 8fa1981
1 file changed
Lines changed: 21 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
552 | 552 | | |
553 | 553 | | |
554 | 554 | | |
555 | | - | |
| 555 | + | |
556 | 556 | | |
| 557 | + | |
557 | 558 | | |
558 | 559 | | |
559 | 560 | | |
| |||
565 | 566 | | |
566 | 567 | | |
567 | 568 | | |
568 | | - | |
569 | | - | |
570 | | - | |
| 569 | + | |
| 570 | + | |
571 | 571 | | |
| 572 | + | |
572 | 573 | | |
573 | 574 | | |
574 | 575 | | |
| |||
600 | 601 | | |
601 | 602 | | |
602 | 603 | | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
603 | 607 | | |
604 | 608 | | |
605 | | - | |
| 609 | + | |
606 | 610 | | |
607 | | - | |
| 611 | + | |
608 | 612 | | |
609 | | - | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
610 | 622 | | |
611 | 623 | | |
612 | 624 | | |
| |||
619 | 631 | | |
620 | 632 | | |
621 | 633 | | |
622 | | - | |
| 634 | + | |
623 | 635 | | |
624 | 636 | | |
| 637 | + | |
625 | 638 | | |
626 | 639 | | |
627 | 640 | | |
| |||
0 commit comments