Skip to content

Commit 6362c4a

Browse files
Wolfram Sanggregkh
authored andcommitted
mailbox: add sanity check for channel array
[ Upstream commit c1aad75 ] Fail gracefully if there is no channel array attached to the mailbox controller. Otherwise the later dereference will cause an OOPS which might not be seen because mailbox controllers might instantiate very early. Remove the comment explaining the obvious while here. Fixes: 2b6d83e ("mailbox: Introduce framework for mailbox") Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Jassi Brar <jassisinghbrar@gmail.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent ee68aad commit 6362c4a

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

drivers/mailbox/mailbox.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,8 +520,7 @@ int mbox_controller_register(struct mbox_controller *mbox)
520520
{
521521
int i, txdone;
522522

523-
/* Sanity check */
524-
if (!mbox || !mbox->dev || !mbox->ops || !mbox->num_chans)
523+
if (!mbox || !mbox->dev || !mbox->ops || !mbox->chans || !mbox->num_chans)
525524
return -EINVAL;
526525

527526
if (mbox->txdone_irq)

0 commit comments

Comments
 (0)