Skip to content

Commit

Permalink
can: c_can: fix race condition in c_can_open()
Browse files Browse the repository at this point in the history
Fix the issue of C_CAN interrupts getting disabled forever when canconfig
utility is used multiple times. According to NAPI usage we disable all
the hardware interrupts in ISR and re-enable them in poll(). Current
implementation calls napi_enable() after hardware interrupts are enabled.
If we get any interrupts between these two steps then we do not process
those interrupts because napi is not enabled. Mostly these interrupts
come because of STATUS is not 0x7 or ERROR interrupts. If napi_enable()
happens before HW interrupts enabled then c_can_poll() function will be
called eventual re-enabling.

This patch moves the napi_enable() call before interrupts enabled.

Cc: stable@kernel.org # 2.6.39+
Signed-off-by: AnilKumar Ch <anilkumar@ti.com>
Acked-by: Wolfgang Grandegger <wg@grandegger.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
  • Loading branch information
AnilKumar Ch authored and Marc Kleine-Budde committed Jun 3, 2012
1 parent 148c87c commit f461f27
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/net/can/c_can/c_can.c
Original file line number Diff line number Diff line change
Expand Up @@ -1064,10 +1064,11 @@ static int c_can_open(struct net_device *dev)
goto exit_irq_fail;
}

napi_enable(&priv->napi);

/* start the c_can controller */
c_can_start(dev);

napi_enable(&priv->napi);
netif_start_queue(dev);

return 0;
Expand Down

0 comments on commit f461f27

Please sign in to comment.