can/isotp: remove timers when closing connection

Timers were not properly removed leading to hard faults if it fires
after the connection is closed.
This commit is contained in:
Vincent Dupont 2019-08-06 16:18:32 +02:00
parent d6356bdc08
commit 32b00706e3

View File

@ -878,6 +878,7 @@ int isotp_release(struct isotp *isotp)
.can_mask = 0xFFFFFFFF, .can_mask = 0xFFFFFFFF,
}; };
raw_can_unsubscribe_rx(isotp->entry.ifnum, &filter, isotp_pid, isotp); raw_can_unsubscribe_rx(isotp->entry.ifnum, &filter, isotp_pid, isotp);
xtimer_remove(&isotp->rx_timer);
if (isotp->rx.snip) { if (isotp->rx.snip) {
DEBUG("isotp_release: freeing rx buf\n"); DEBUG("isotp_release: freeing rx buf\n");
@ -887,6 +888,8 @@ int isotp_release(struct isotp *isotp)
isotp->rx.state = ISOTP_IDLE; isotp->rx.state = ISOTP_IDLE;
isotp->entry.target.pid = KERNEL_PID_UNDEF; isotp->entry.target.pid = KERNEL_PID_UNDEF;
xtimer_remove(&isotp->tx_timer);
mutex_lock(&lock); mutex_lock(&lock);
LL_DELETE(isotp_list, isotp); LL_DELETE(isotp_list, isotp);
mutex_unlock(&lock); mutex_unlock(&lock);