Skip to content

Commit 95a757a

Browse files
committed
loopback: fix lockdep splat
jira LE-3201 Rebuild_History Non-Buildable kernel-rt-4.18.0-553.27.1.rt7.368.el8_10 commit-author Mahesh Bandewar <maheshb@google.com> commit d62962b Empty-Commit: Cherry-Pick Conflicts during history rebuild. Will be included in final tarball splat. Ref for failed cherry-pick at: ciq/ciq_backports/kernel-rt-4.18.0-553.27.1.rt7.368.el8_10/d62962b3.failed dev_init_scheduler() and dev_activate() expect the caller to hold RTNL. Since we don't want blackhole device to be initialized per ns, we are initializing at init. [ 3.855027] Call Trace: [ 3.855034] dump_stack+0x67/0x95 [ 3.855037] lockdep_rcu_suspicious+0xd5/0x110 [ 3.855044] dev_init_scheduler+0xe3/0x120 [ 3.855048] ? net_olddevs_init+0x60/0x60 [ 3.855050] blackhole_netdev_init+0x45/0x6e [ 3.855052] do_one_initcall+0x6c/0x2fa [ 3.855058] ? rcu_read_lock_sched_held+0x8c/0xa0 [ 3.855066] kernel_init_freeable+0x1e5/0x288 [ 3.855071] ? rest_init+0x260/0x260 [ 3.855074] kernel_init+0xf/0x180 [ 3.855076] ? rest_init+0x260/0x260 [ 3.855078] ret_from_fork+0x24/0x30 Fixes: 4de83b8 ("loopback: create blackhole net device similar to loopack.") Reported-by: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Eric Dumazet <edumazet@google.com> Signed-off-by: Mahesh Bandewar <maheshb@google.com> Tested-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: David S. Miller <davem@davemloft.net> (cherry picked from commit d62962b) Signed-off-by: Jonathan Maple <jmaple@ciq.com> # Conflicts: # drivers/net/loopback.c
1 parent 1b9388d commit 95a757a

File tree

1 file changed

+93
-0
lines changed

1 file changed

+93
-0
lines changed
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
loopback: fix lockdep splat
2+
3+
jira LE-3201
4+
Rebuild_History Non-Buildable kernel-rt-4.18.0-553.27.1.rt7.368.el8_10
5+
commit-author Mahesh Bandewar <maheshb@google.com>
6+
commit d62962b37cebdc936e2bfcd69ea685da2c433727
7+
Empty-Commit: Cherry-Pick Conflicts during history rebuild.
8+
Will be included in final tarball splat. Ref for failed cherry-pick at:
9+
ciq/ciq_backports/kernel-rt-4.18.0-553.27.1.rt7.368.el8_10/d62962b3.failed
10+
11+
dev_init_scheduler() and dev_activate() expect the caller to
12+
hold RTNL. Since we don't want blackhole device to be initialized
13+
per ns, we are initializing at init.
14+
15+
[ 3.855027] Call Trace:
16+
[ 3.855034] dump_stack+0x67/0x95
17+
[ 3.855037] lockdep_rcu_suspicious+0xd5/0x110
18+
[ 3.855044] dev_init_scheduler+0xe3/0x120
19+
[ 3.855048] ? net_olddevs_init+0x60/0x60
20+
[ 3.855050] blackhole_netdev_init+0x45/0x6e
21+
[ 3.855052] do_one_initcall+0x6c/0x2fa
22+
[ 3.855058] ? rcu_read_lock_sched_held+0x8c/0xa0
23+
[ 3.855066] kernel_init_freeable+0x1e5/0x288
24+
[ 3.855071] ? rest_init+0x260/0x260
25+
[ 3.855074] kernel_init+0xf/0x180
26+
[ 3.855076] ? rest_init+0x260/0x260
27+
[ 3.855078] ret_from_fork+0x24/0x30
28+
29+
Fixes: 4de83b88c66 ("loopback: create blackhole net device similar to loopack.")
30+
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
31+
Cc: Eric Dumazet <edumazet@google.com>
32+
Signed-off-by: Mahesh Bandewar <maheshb@google.com>
33+
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
34+
Signed-off-by: David S. Miller <davem@davemloft.net>
35+
(cherry picked from commit d62962b37cebdc936e2bfcd69ea685da2c433727)
36+
Signed-off-by: Jonathan Maple <jmaple@ciq.com>
37+
38+
# Conflicts:
39+
# drivers/net/loopback.c
40+
diff --cc drivers/net/loopback.c
41+
index 2df7f60fe052,14545a8797a8..000000000000
42+
--- a/drivers/net/loopback.c
43+
+++ b/drivers/net/loopback.c
44+
@@@ -229,3 -231,45 +229,48 @@@ out
45+
struct pernet_operations __net_initdata loopback_net_ops = {
46+
.init = loopback_net_init,
47+
};
48+
++<<<<<<< HEAD
49+
++=======
50+
+
51+
+ /* blackhole netdevice */
52+
+ static netdev_tx_t blackhole_netdev_xmit(struct sk_buff *skb,
53+
+ struct net_device *dev)
54+
+ {
55+
+ kfree_skb(skb);
56+
+ net_warn_ratelimited("%s(): Dropping skb.\n", __func__);
57+
+ return NETDEV_TX_OK;
58+
+ }
59+
+
60+
+ static const struct net_device_ops blackhole_netdev_ops = {
61+
+ .ndo_start_xmit = blackhole_netdev_xmit,
62+
+ };
63+
+
64+
+ /* This is a dst-dummy device used specifically for invalidated
65+
+ * DSTs and unlike loopback, this is not per-ns.
66+
+ */
67+
+ static void blackhole_netdev_setup(struct net_device *dev)
68+
+ {
69+
+ gen_lo_setup(dev, ETH_MIN_MTU, NULL, NULL, &blackhole_netdev_ops, NULL);
70+
+ }
71+
+
72+
+ /* Setup and register the blackhole_netdev. */
73+
+ static int __init blackhole_netdev_init(void)
74+
+ {
75+
+ blackhole_netdev = alloc_netdev(0, "blackhole_dev", NET_NAME_UNKNOWN,
76+
+ blackhole_netdev_setup);
77+
+ if (!blackhole_netdev)
78+
+ return -ENOMEM;
79+
+
80+
+ rtnl_lock();
81+
+ dev_init_scheduler(blackhole_netdev);
82+
+ dev_activate(blackhole_netdev);
83+
+ rtnl_unlock();
84+
+
85+
+ blackhole_netdev->flags |= IFF_UP | IFF_RUNNING;
86+
+ dev_net_set(blackhole_netdev, &init_net);
87+
+
88+
+ return 0;
89+
+ }
90+
+
91+
+ device_initcall(blackhole_netdev_init);
92+
++>>>>>>> d62962b37ceb (loopback: fix lockdep splat)
93+
* Unmerged path drivers/net/loopback.c

0 commit comments

Comments
 (0)