Eric Dumazet
9077f052ab
net: propagate errors correctly in register_netdevice()
...
If netdev_name_node_head_alloc() fails to allocate
memory, we absolutely want register_netdevice() to return
-ENOMEM instead of zero :/
One of the syzbot report looked like :
general protection fault: 0000 [#1 ] PREEMPT SMP KASAN
CPU: 1 PID: 8760 Comm: syz-executor839 Not tainted 5.3.0+ #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:ovs_vport_add+0x185/0x500 net/openvswitch/vport.c:205
Code: 89 c6 e8 3e b6 3a fa 49 81 fc 00 f0 ff ff 0f 87 6d 02 00 00 e8 8c b4 3a fa 4c 89 e2 48 b8 00 00 00 00 00 fc ff df 48 c1 ea 03 <80> 3c 02 00 0f 85 d3 02 00 00 49 8d 7c 24 08 49 8b 34 24 48 b8 00
RSP: 0018:ffff88808fe5f4e0 EFLAGS: 00010247
RAX: dffffc0000000000 RBX: ffffffff89be8820 RCX: ffffffff87385162
RDX: 0000000000000000 RSI: ffffffff87385174 RDI: 0000000000000007
RBP: ffff88808fe5f510 R08: ffff8880933c6600 R09: fffffbfff14ee13c
R10: fffffbfff14ee13b R11: ffffffff8a7709df R12: 0000000000000004
R13: ffffffff89be8850 R14: ffff88808fe5f5e0 R15: 0000000000000002
FS: 0000000001d71880(0000) GS:ffff8880ae900000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020000280 CR3: 0000000096e4c000 CR4: 00000000001406e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
new_vport+0x1b/0x1d0 net/openvswitch/datapath.c:194
ovs_dp_cmd_new+0x5e5/0xe30 net/openvswitch/datapath.c:1644
genl_family_rcv_msg+0x74b/0xf90 net/netlink/genetlink.c:629
genl_rcv_msg+0xca/0x170 net/netlink/genetlink.c:654
netlink_rcv_skb+0x177/0x450 net/netlink/af_netlink.c:2477
genl_rcv+0x29/0x40 net/netlink/genetlink.c:665
netlink_unicast_kernel net/netlink/af_netlink.c:1302 [inline]
netlink_unicast+0x531/0x710 net/netlink/af_netlink.c:1328
netlink_sendmsg+0x8a5/0xd60 net/netlink/af_netlink.c:1917
sock_sendmsg_nosec net/socket.c:637 [inline]
sock_sendmsg+0xd7/0x130 net/socket.c:657
___sys_sendmsg+0x803/0x920 net/socket.c:2311
__sys_sendmsg+0x105/0x1d0 net/socket.c:2356
__do_sys_sendmsg net/socket.c:2365 [inline]
__se_sys_sendmsg net/socket.c:2363 [inline]
__x64_sys_sendmsg+0x78/0xb0 net/socket.c:2363
Fixes: ff92741270bf ("net: introduce name_node struct to be used in hashlist")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Jiri Pirko <jiri@mellanox.com>
Reported-by: syzbot <syzkaller@googlegroups.com>
Tested-by: Willem de Bruijn <willemb@google.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-10-03 12:31:06 -07:00
..
2019-07-06 12:50:01 +02:00
2019-09-27 15:10:34 -07:00
2019-06-19 17:09:55 +02:00
2019-06-22 08:59:24 -04:00
2019-09-24 16:37:18 +02:00
2019-09-05 12:33:28 +02:00
2019-09-24 16:37:18 +02:00
2019-09-26 08:56:17 +02:00
2019-09-18 12:34:53 -07:00
2019-07-25 18:00:41 -07:00
2019-07-12 16:03:16 -07:00
2019-09-15 14:17:27 +02:00
2019-10-02 14:47:51 -07:00
2019-09-04 14:22:33 +02:00
2019-09-16 12:06:25 +02:00
2019-10-03 12:31:06 -07:00
2019-05-30 11:29:52 -07:00
2019-09-27 12:05:02 +02:00
2019-05-24 17:36:42 +02:00
2019-07-10 18:43:43 -07:00
2019-09-17 23:51:10 +02:00
2019-06-07 11:00:14 -07:00
2019-07-11 14:37:45 -07:00
2019-09-24 16:37:18 +02:00
2019-09-26 08:56:17 +02:00
2019-10-02 12:15:15 -04:00
2019-10-01 14:59:03 -07:00
2019-07-29 10:26:14 -07:00
2019-09-27 10:27:14 +02:00
2019-07-08 19:48:57 -07:00
2019-07-30 14:42:13 -07:00
2019-06-23 13:24:17 -07:00
2019-06-17 20:20:36 -07:00
2019-06-05 17:36:36 +02:00
2019-09-15 14:17:27 +02:00
2019-05-30 11:26:41 -07:00
2019-08-25 14:34:08 -07:00
2019-09-19 18:04:40 -07:00
2019-09-27 20:15:00 +02:00
2019-09-01 11:45:02 -07:00
2019-06-14 19:50:33 -07:00
2019-07-24 15:49:05 -07:00
2019-09-24 16:37:18 +02:00
2019-06-19 17:09:55 +02:00
2019-09-26 09:32:33 +02:00
2019-08-15 13:59:48 -07:00
2019-06-05 17:37:07 +02:00
2019-09-16 09:18:03 +02:00
2019-09-21 18:45:46 -07:00
2019-10-03 12:11:08 -07:00
2019-06-19 17:09:55 +02:00
2019-05-30 11:26:32 -07:00
2019-09-15 14:17:27 +02:00
2019-10-02 14:26:33 -07:00
2019-09-27 12:05:02 +02:00
2019-08-20 12:25:14 -07:00
2019-06-22 08:59:24 -04:00
2019-09-27 17:00:27 -07:00
2019-05-30 11:26:32 -07:00
2019-09-15 14:17:27 +02:00
2019-09-07 18:10:34 +02:00
2019-06-07 11:00:14 -07:00
2019-10-01 21:26:51 -04:00
2019-08-10 15:25:47 -07:00
2019-09-11 14:57:17 +01:00
2019-05-24 17:27:12 +02:00
2019-09-28 17:47:33 -07:00
2019-09-15 14:17:27 +02:00
2019-05-31 15:30:03 -06:00
2019-08-17 12:40:08 -07:00
2019-02-28 08:24:23 -07:00
2019-07-19 10:42:02 -07:00
2019-05-21 10:50:45 +02:00