.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | |
---|
3 | 4 | * l1oip.c low level driver for tunneling layer 1 over IP |
---|
.. | .. |
---|
5 | 6 | * NOTE: It is not compatible with TDMoIP nor "ISDN over IP". |
---|
6 | 7 | * |
---|
7 | 8 | * Author Andreas Eversberg (jolly@eversberg.eu) |
---|
8 | | - * |
---|
9 | | - * This program is free software; you can redistribute it and/or modify |
---|
10 | | - * it under the terms of the GNU General Public License as published by |
---|
11 | | - * the Free Software Foundation; either version 2, or (at your option) |
---|
12 | | - * any later version. |
---|
13 | | - * |
---|
14 | | - * This program is distributed in the hope that it will be useful, |
---|
15 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
16 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
17 | | - * GNU General Public License for more details. |
---|
18 | | - * |
---|
19 | | - * You should have received a copy of the GNU General Public License |
---|
20 | | - * along with this program; if not, write to the Free Software |
---|
21 | | - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
---|
22 | | - * |
---|
23 | 9 | */ |
---|
24 | 10 | |
---|
25 | 11 | /* module parameters: |
---|
.. | .. |
---|
289 | 275 | p = frame; |
---|
290 | 276 | |
---|
291 | 277 | /* restart timer */ |
---|
292 | | - if (time_before(hc->keep_tl.expires, jiffies + 5 * HZ)) |
---|
| 278 | + if (time_before(hc->keep_tl.expires, jiffies + 5 * HZ) && !hc->shutdown) |
---|
293 | 279 | mod_timer(&hc->keep_tl, jiffies + L1OIP_KEEPALIVE * HZ); |
---|
294 | 280 | else |
---|
295 | 281 | hc->keep_tl.expires = jiffies + L1OIP_KEEPALIVE * HZ; |
---|
.. | .. |
---|
615 | 601 | goto multiframe; |
---|
616 | 602 | |
---|
617 | 603 | /* restart timer */ |
---|
618 | | - if (time_before(hc->timeout_tl.expires, jiffies + 5 * HZ) || !hc->timeout_on) { |
---|
| 604 | + if ((time_before(hc->timeout_tl.expires, jiffies + 5 * HZ) || |
---|
| 605 | + !hc->timeout_on) && |
---|
| 606 | + !hc->shutdown) { |
---|
619 | 607 | hc->timeout_on = 1; |
---|
620 | 608 | mod_timer(&hc->timeout_tl, jiffies + L1OIP_TIMEOUT * HZ); |
---|
621 | 609 | } else /* only adjust timer */ |
---|
.. | .. |
---|
718 | 706 | printk(KERN_DEBUG "%s: socket created and open\n", |
---|
719 | 707 | __func__); |
---|
720 | 708 | while (!signal_pending(current)) { |
---|
721 | | - iov_iter_kvec(&msg.msg_iter, READ | ITER_KVEC, &iov, 1, |
---|
722 | | - recvbuf_size); |
---|
| 709 | + iov_iter_kvec(&msg.msg_iter, READ, &iov, 1, recvbuf_size); |
---|
723 | 710 | recvlen = sock_recvmsg(socket, &msg, 0); |
---|
724 | 711 | if (recvlen > 0) { |
---|
725 | 712 | l1oip_socket_parse(hc, &sin_rx, recvbuf, recvlen); |
---|
.. | .. |
---|
1247 | 1234 | { |
---|
1248 | 1235 | int ch; |
---|
1249 | 1236 | |
---|
1250 | | - if (timer_pending(&hc->keep_tl)) |
---|
1251 | | - del_timer(&hc->keep_tl); |
---|
| 1237 | + hc->shutdown = true; |
---|
1252 | 1238 | |
---|
1253 | | - if (timer_pending(&hc->timeout_tl)) |
---|
1254 | | - del_timer(&hc->timeout_tl); |
---|
| 1239 | + del_timer_sync(&hc->keep_tl); |
---|
| 1240 | + del_timer_sync(&hc->timeout_tl); |
---|
1255 | 1241 | |
---|
1256 | 1242 | cancel_work_sync(&hc->workq); |
---|
1257 | 1243 | |
---|
.. | .. |
---|
1269 | 1255 | mISDN_freebchannel(hc->chan[ch].bch); |
---|
1270 | 1256 | kfree(hc->chan[ch].bch); |
---|
1271 | 1257 | #ifdef REORDER_DEBUG |
---|
1272 | | - if (hc->chan[ch].disorder_skb) |
---|
1273 | | - dev_kfree_skb(hc->chan[ch].disorder_skb); |
---|
| 1258 | + dev_kfree_skb(hc->chan[ch].disorder_skb); |
---|
1274 | 1259 | #endif |
---|
1275 | 1260 | } |
---|
1276 | 1261 | } |
---|