hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/drivers/net/wan/lapbether.c
....@@ -1,13 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * "LAPB via ethernet" driver release 001
34 *
45 * This code REQUIRES 2.1.15 or higher/ NET3.038
5
- *
6
- * This module:
7
- * This module is free software; you can redistribute it and/or
8
- * modify it under the terms of the GNU General Public License
9
- * as published by the Free Software Foundation; either version
10
- * 2 of the License, or (at your option) any later version.
116 *
127 * This is a "pseudo" network driver to allow LAPB over Ethernet.
138 *
....@@ -71,7 +66,7 @@
7166 {
7267 struct lapbethdev *lapbeth;
7368
74
- list_for_each_entry_rcu(lapbeth, &lapbeth_devices, node) {
69
+ list_for_each_entry_rcu(lapbeth, &lapbeth_devices, node, lockdep_rtnl_is_held()) {
7570 if (lapbeth->ethdev == dev)
7671 return lapbeth;
7772 }
....@@ -139,10 +134,12 @@
139134 {
140135 unsigned char *ptr;
141136
142
- skb_push(skb, 1);
143
-
144
- if (skb_cow(skb, 1))
137
+ if (skb_cow(skb, 1)) {
138
+ kfree_skb(skb);
145139 return NET_RX_DROP;
140
+ }
141
+
142
+ skb_push(skb, 1);
146143
147144 ptr = skb->data;
148145 *ptr = X25_IFACE_DATA;
....@@ -180,7 +177,7 @@
180177 case X25_IFACE_DISCONNECT:
181178 if ((err = lapb_disconnect_request(dev)) != LAPB_OK)
182179 pr_err("lapb_disconnect_request err: %d\n", err);
183
- /* Fall thru */
180
+ fallthrough;
184181 default:
185182 goto drop;
186183 }
....@@ -406,7 +403,7 @@
406403 if (dev_net(dev) != &init_net)
407404 return NOTIFY_DONE;
408405
409
- if (!dev_is_ethdev(dev))
406
+ if (!dev_is_ethdev(dev) && !lapbeth_get_x25_dev(dev))
410407 return NOTIFY_DONE;
411408
412409 switch (event) {