Skip to content

Commit

Permalink
mailbox: th1520: Fix memory corruption due to incorrect array size
Browse files Browse the repository at this point in the history
The functions th1520_mbox_suspend_noirq and th1520_mbox_resume_noirq are
intended to save and restore the interrupt mask registers in the MBOX
ICU0. However, the array used to store these registers was incorrectly
sized, leading to memory corruption when accessing all four registers.

This commit corrects the array size to accommodate all four interrupt
mask registers, preventing memory corruption during suspend and resume
operations.

Fixes: 5d4d263 ("mailbox: Introduce support for T-head TH1520 Mailbox driver")
Reported-by: Dan Carpenter <[email protected]>
Closes: https://lore.kernel.org/all/[email protected]/
Signed-off-by: Michal Wilczynski <[email protected]>
Signed-off-by: Jassi Brar <[email protected]>
  • Loading branch information
Michal Wilczynski authored and Jassi Brar committed Jan 18, 2025
1 parent 170a264 commit db04986
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/mailbox/mailbox-th1520.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#ifdef CONFIG_PM_SLEEP
/* store MBOX context across system-wide suspend/resume transitions */
struct th1520_mbox_context {
u32 intr_mask[TH_1520_MBOX_CHANS - 1];
u32 intr_mask[TH_1520_MBOX_CHANS];
};
#endif

Expand Down

0 comments on commit db04986

Please sign in to comment.