Skip to content

Commit 06d4ef3

Browse files
hormsmarckleinebudde
authored andcommitted
can: m_can: Release irq on error in m_can_open
It appears that the irq requested in m_can_open() may be leaked if an error subsequently occurs: if m_can_start() fails. Address this by calling free_irq in the unwind path for such cases. Flagged by Smatch. Compile tested only. Fixes: eaacfea ("can: m_can: Call the RAM init directly from m_can_chip_config") Acked-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Simon Horman <horms@kernel.org> Link: https://lore.kernel.org/all/20240805-mcan-irq-v2-1-7154c0484819@kernel.org Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
1 parent 76fe372 commit 06d4ef3

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

drivers/net/can/m_can/m_can.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2052,7 +2052,7 @@ static int m_can_open(struct net_device *dev)
20522052
/* start the m_can controller */
20532053
err = m_can_start(dev);
20542054
if (err)
2055-
goto exit_irq_fail;
2055+
goto exit_start_fail;
20562056

20572057
if (!cdev->is_peripheral)
20582058
napi_enable(&cdev->napi);
@@ -2061,6 +2061,9 @@ static int m_can_open(struct net_device *dev)
20612061

20622062
return 0;
20632063

2064+
exit_start_fail:
2065+
if (cdev->is_peripheral || dev->irq)
2066+
free_irq(dev->irq, dev);
20642067
exit_irq_fail:
20652068
if (cdev->is_peripheral)
20662069
destroy_workqueue(cdev->tx_wq);

0 commit comments

Comments
 (0)