Skip to content

Commit 5c20929

Browse files
Wolfram Sanggregkh
authored andcommitted
mailbox: mailbox-test: don't free the reused channel
[ Upstream commit 88ebadb ] The RX channel can be aliased to the TX channel if it has a different MMIO. This special case needs to be handled when freeing the channels otherwise a double-free occurs. Fixes: 8ea4484 ("mailbox: Add generic mechanism for testing Mailbox Controllers") Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Jassi Brar <jassisinghbrar@gmail.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 6362c4a commit 5c20929

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/mailbox/mailbox-test.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ static int mbox_test_probe(struct platform_device *pdev)
422422
err_free_chans:
423423
if (tdev->tx_channel)
424424
mbox_free_channel(tdev->tx_channel);
425-
if (tdev->rx_channel)
425+
if (tdev->rx_channel && tdev->rx_channel != tdev->tx_channel)
426426
mbox_free_channel(tdev->rx_channel);
427427
return ret;
428428
}
@@ -435,7 +435,7 @@ static void mbox_test_remove(struct platform_device *pdev)
435435

436436
if (tdev->tx_channel)
437437
mbox_free_channel(tdev->tx_channel);
438-
if (tdev->rx_channel)
438+
if (tdev->rx_channel && tdev->rx_channel != tdev->tx_channel)
439439
mbox_free_channel(tdev->rx_channel);
440440
}
441441

0 commit comments

Comments
 (0)