can: dev: fix deadlock reported after bus-off
authorSergei Miroshnichenko <sergeimir@emcraft.com>
Wed, 7 Sep 2016 13:51:12 +0000 (16:51 +0300)
committerBen Hutchings <ben@decadent.org.uk>
Sun, 20 Nov 2016 01:01:42 +0000 (01:01 +0000)
commit1f53d4c9835d7af7be92cdfc46b3062d051c1834
tree02df897c8303b07f006213c0e846039271d50091
parentaa1e138422a6bd04a7b0cbd425919cbd834cd395
can: dev: fix deadlock reported after bus-off

commit 9abefcb1aaa58b9d5aa40a8bb12c87d02415e4c8 upstream.

A timer was used to restart after the bus-off state, leading to a
relatively large can_restart() executed in an interrupt context,
which in turn sets up pinctrl. When this happens during system boot,
there is a high probability of grabbing the pinctrl_list_mutex,
which is locked already by the probe() of other device, making the
kernel suspect a deadlock condition [1].

To resolve this issue, the restart_timer is replaced by a delayed
work.

[1] https://github.com/victronenergy/venus/issues/24

Signed-off-by: Sergei Miroshnichenko <sergeimir@emcraft.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/net/can/dev.c
include/linux/can/dev.h