[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CABb+yY1W=n-KygVb26v_o7Hu7ZNQjyhgA4zbbka2M9_9ZNtNnw@mail.gmail.com>
Date: Sat, 18 Jan 2025 13:35:21 -0600
From: Jassi Brar <jassisinghbrar@...il.com>
To: Michal Wilczynski <m.wilczynski@...sung.com>
Cc: drew@...7.com, guoren@...nel.org, wefu@...hat.com,
linux-riscv@...ts.infradead.org, linux-kernel@...r.kernel.org,
Dan Carpenter <dan.carpenter@...aro.org>
Subject: Re: [PATCH] mailbox: th1520: Fix memory corruption due to incorrect
array size
On Mon, Dec 2, 2024 at 4:06 AM Michal Wilczynski
<m.wilczynski@...sung.com> wrote:
>
> 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: 5d4d263e1c6b ("mailbox: Introduce support for T-head TH1520 Mailbox driver")
> Reported-by: Dan Carpenter <dan.carpenter@...aro.org>
> Closes: https://lore.kernel.org/all/a99e72be-8490-4960-ad26-cbfef6af238f@stanley.mountain/
> Signed-off-by: Michal Wilczynski <m.wilczynski@...sung.com>
> ---
> drivers/mailbox/mailbox-th1520.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mailbox/mailbox-th1520.c b/drivers/mailbox/mailbox-th1520.c
> index 4e84640ac3b8..0d95e1898702 100644
> --- a/drivers/mailbox/mailbox-th1520.c
> +++ b/drivers/mailbox/mailbox-th1520.c
> @@ -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
>
I just replied to a patch from Advait Dhamorikar trying to address the
same problem :)
This one seems proper. Will take it.
Thanks
> --
> 2.34.1
>
Powered by blists - more mailing lists