forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 cde9070d9970eef1f7ec2360586c802a16230ad8
kernel/drivers/isdn/mISDN/l1oip_core.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23
34 * l1oip.c low level driver for tunneling layer 1 over IP
....@@ -5,21 +6,6 @@
56 * NOTE: It is not compatible with TDMoIP nor "ISDN over IP".
67 *
78 * 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
- *
239 */
2410
2511 /* module parameters:
....@@ -289,7 +275,7 @@
289275 p = frame;
290276
291277 /* 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)
293279 mod_timer(&hc->keep_tl, jiffies + L1OIP_KEEPALIVE * HZ);
294280 else
295281 hc->keep_tl.expires = jiffies + L1OIP_KEEPALIVE * HZ;
....@@ -615,7 +601,9 @@
615601 goto multiframe;
616602
617603 /* 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) {
619607 hc->timeout_on = 1;
620608 mod_timer(&hc->timeout_tl, jiffies + L1OIP_TIMEOUT * HZ);
621609 } else /* only adjust timer */
....@@ -718,8 +706,7 @@
718706 printk(KERN_DEBUG "%s: socket created and open\n",
719707 __func__);
720708 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);
723710 recvlen = sock_recvmsg(socket, &msg, 0);
724711 if (recvlen > 0) {
725712 l1oip_socket_parse(hc, &sin_rx, recvbuf, recvlen);
....@@ -1247,11 +1234,10 @@
12471234 {
12481235 int ch;
12491236
1250
- if (timer_pending(&hc->keep_tl))
1251
- del_timer(&hc->keep_tl);
1237
+ hc->shutdown = true;
12521238
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);
12551241
12561242 cancel_work_sync(&hc->workq);
12571243
....@@ -1269,8 +1255,7 @@
12691255 mISDN_freebchannel(hc->chan[ch].bch);
12701256 kfree(hc->chan[ch].bch);
12711257 #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);
12741259 #endif
12751260 }
12761261 }