Netdev List
 help / color / mirror / Atom feed
* general protection fault in __vunmap
From: syzbot @ 2019-02-16  7:01 UTC (permalink / raw)
  To: davem, herbert, linux-kernel, netdev, steffen.klassert,
	syzkaller-bugs

Hello,

syzbot found the following crash on:

HEAD commit:    cb5b020a8d38 Revert "exec: load_script: don't blindly trun..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=13c2886cc00000
kernel config:  https://syzkaller.appspot.com/x/.config?x=ee434566c893c7b1
dashboard link: https://syzkaller.appspot.com/bug?extid=39d3a56f2f717d237007
compiler:       gcc (GCC) 9.0.0 20181231 (experimental)

Unfortunately, I don't have any reproducer for this crash yet.

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+39d3a56f2f717d237007@syzkaller.appspotmail.com

kasan: CONFIG_KASAN_INLINE enabled
kasan: GPF could be caused by NULL-ptr deref or user memory access
general protection fault: 0000 [#1] PREEMPT SMP KASAN
CPU: 0 PID: 23956 Comm: syz-executor.3 Not tainted 5.0.0-rc6+ #72
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011
RIP: 0010:__vunmap+0x68/0x400 mm/vmalloc.c:1508
Code: 85 e4 0f 85 de 02 00 00 e8 45 c7 d0 ff 4c 89 ef e8 9d 82 ff ff 48 ba  
00 00 00 00 00 fc ff df 48 8d 78 48 48 89 f9 48 c1 e9 03 <80> 3c 11 00 0f  
85 50 03 00 00 4c 8b 60 48 4d 85 e4 0f 84 bd 02 00
RSP: 0018:ffff88809613f4b0 EFLAGS: 00010206
RAX: 0000000000000000 RBX: 0000000000000001 RCX: 0000000000000009
RDX: dffffc0000000000 RSI: 0000000000000004 RDI: 0000000000000048
RBP: ffff88809613f4f0 R08: 1ffffffff1146d18 R09: fffffbfff1146d19
R10: fffffbfff1146d18 R11: ffffffff88a368c3 R12: 0000000000000000
R13: 0000004e00000000 R14: ffffe8ffffc71948 R15: 0000607f51471948
FS:  00007fa9e49b6700(0000) GS:ffff8880ae800000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fc7182d2000 CR3: 000000004b7bb000 CR4: 00000000001426f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
  vfree+0x8d/0x140 mm/vmalloc.c:1597
  ipcomp_free_scratches+0xc0/0x150 net/xfrm/xfrm_ipcomp.c:216
  ipcomp_free_data net/xfrm/xfrm_ipcomp.c:325 [inline]
  ipcomp_init_state+0x76d/0xa10 net/xfrm/xfrm_ipcomp.c:377
  ipcomp6_init_state+0xc9/0x880 net/ipv6/ipcomp6.c:165
  __xfrm_init_state+0x557/0xef0 net/xfrm/xfrm_state.c:2302
  xfrm_init_state+0x1e/0x80 net/xfrm/xfrm_state.c:2328
  pfkey_msg2xfrm_state net/key/af_key.c:1307 [inline]
  pfkey_add+0x1da7/0x2fd0 net/key/af_key.c:1524
  pfkey_process+0x6d2/0x810 net/key/af_key.c:2844
  pfkey_sendmsg+0x40b/0xbe0 net/key/af_key.c:3683
  sock_sendmsg_nosec net/socket.c:621 [inline]
  sock_sendmsg+0xdd/0x130 net/socket.c:631
  ___sys_sendmsg+0x3e2/0x930 net/socket.c:2114
  __sys_sendmmsg+0x1c3/0x4e0 net/socket.c:2209
  __do_sys_sendmmsg net/socket.c:2238 [inline]
  __se_sys_sendmmsg net/socket.c:2235 [inline]
  __x64_sys_sendmmsg+0x9d/0x100 net/socket.c:2235
  do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290
  entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x457e29
Code: ad b8 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7  
48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff  
ff 0f 83 7b b8 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007fa9e49b5c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000133
RAX: ffffffffffffffda RBX: 0000000000000004 RCX: 0000000000457e29
RDX: 0400000000000142 RSI: 0000000020000180 RDI: 0000000000000004
RBP: 000000000073c040 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007fa9e49b66d4
R13: 00000000004c4dd8 R14: 00000000004d8a70 R15: 00000000ffffffff
Modules linked in:
kobject: 'loop4' (00000000647dbe39): kobject_uevent_env
kobject: 'loop4' (00000000647dbe39): fill_kobj_path: path  
= '/devices/virtual/block/loop4'
kobject: 'kvm' (0000000078525e49): kobject_uevent_env
kobject: 'kvm' (0000000078525e49): fill_kobj_path: path  
= '/devices/virtual/misc/kvm'
---[ end trace 25e2186da6a07104 ]---
RIP: 0010:__vunmap+0x68/0x400 mm/vmalloc.c:1508
IPVS: ftp: loaded support on port[0] = 21
Code: 85 e4 0f 85 de 02 00 00 e8 45 c7 d0 ff 4c 89 ef e8 9d 82 ff ff 48 ba  
00 00 00 00 00 fc ff df 48 8d 78 48 48 89 f9 48 c1 e9 03 <80> 3c 11 00 0f  
85 50 03 00 00 4c 8b 60 48 4d 85 e4 0f 84 bd 02 00
kobject: 'kvm' (0000000078525e49): kobject_uevent_env
kobject: 'lo' (00000000532a5fa3): kobject_add_internal: parent: 'net',  
set: 'devices'
kobject: 'kvm' (0000000078525e49): fill_kobj_path: path  
= '/devices/virtual/misc/kvm'
RSP: 0018:ffff88809613f4b0 EFLAGS: 00010206
RAX: 0000000000000000 RBX: 0000000000000001 RCX: 0000000000000009
kobject: 'kvm' (0000000078525e49): kobject_uevent_env
kobject: 'lo' (00000000532a5fa3): kobject_uevent_env
RDX: dffffc0000000000 RSI: 0000000000000004 RDI: 0000000000000048
kobject: 'kvm' (0000000078525e49): fill_kobj_path: path  
= '/devices/virtual/misc/kvm'
RBP: ffff88809613f4f0 R08: 1ffffffff1146d18 R09: fffffbfff1146d19
kobject: 'lo' (00000000532a5fa3): fill_kobj_path: path  
= '/devices/virtual/net/lo'
R10: fffffbfff1146d18 R11: ffffffff88a368c3 R12: 0000000000000000
R13: 0000004e00000000 R14: ffffe8ffffc71948 R15: 0000607f51471948
kobject: 'loop4' (00000000647dbe39): kobject_uevent_env
kobject: 'loop4' (00000000647dbe39): fill_kobj_path: path  
= '/devices/virtual/block/loop4'
FS:  00007fa9e49b6700(0000) GS:ffff8880ae900000(0000) knlGS:0000000000000000
kobject: 'queues' (00000000ae77e0e8): kobject_add_internal: parent: 'lo',  
set: '<NULL>'
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000000000070a158 CR3: 000000004b7bb000 CR4: 00000000001406e0
kobject: 'loop5' (00000000975607f3): kobject_uevent_env
kobject: 'queues' (00000000ae77e0e8): kobject_uevent_env
kobject: 'loop5' (00000000975607f3): fill_kobj_path: path  
= '/devices/virtual/block/loop5'
kobject: 'queues' (00000000ae77e0e8): kobject_uevent_env: filter function  
caused the event to drop!
kobject: 'rx-0' (000000002f4df33a): kobject_add_internal: parent: 'queues',  
set: 'queues'
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400


---
This bug is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#bug-status-tracking for how to communicate with  
syzbot.

^ permalink raw reply

* general protection fault in reuseport_add_sock
From: syzbot @ 2019-02-16  7:01 UTC (permalink / raw)
  To: ast, daniel, davem, kafai, linux-kernel, lucien.xin, netdev,
	songliubraving, syzkaller-bugs, yhs

Hello,

syzbot found the following crash on:

HEAD commit:    f9bcc9f3ee4f net: ethernet: freescale: set FEC ethtool reg..
git tree:       net
console output: https://syzkaller.appspot.com/x/log.txt?x=158a10f3400000
kernel config:  https://syzkaller.appspot.com/x/.config?x=8f00801d7b7c4fe6
dashboard link: https://syzkaller.appspot.com/bug?extid=675ee297acac988852c1
compiler:       gcc (GCC) 9.0.0 20181231 (experimental)

Unfortunately, I don't have any reproducer for this crash yet.

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+675ee297acac988852c1@syzkaller.appspotmail.com

kasan: CONFIG_KASAN_INLINE enabled
kasan: GPF could be caused by NULL-ptr deref or user memory access
general protection fault: 0000 [#1] PREEMPT SMP KASAN
kobject: 'loop2' (000000005809b865): kobject_uevent_env
CPU: 1 PID: 14725 Comm: syz-executor.3 Not tainted 5.0.0-rc5+ #78
kobject: 'loop2' (000000005809b865): fill_kobj_path: path  
= '/devices/virtual/block/loop2'
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011
RIP: 0010:reuseport_add_sock+0x187/0x8f0 net/core/sock_reuseport.c:170
Code: e8 ce 4e f2 fb 66 83 fb 01 0f 85 54 06 00 00 e8 5f 4d f2 fb 4d 8d 74  
24 12 48 b8 00 00 00 00 00 fc ff df 4c 89 f2 48 c1 ea 03 <0f> b6 14 02 4c  
89 f0 83 e0 07 83 c0 01 38 d0 7c 08 84 d2 0f 85 fc
RSP: 0018:ffff888066abfca0 EFLAGS: 00010202
RAX: dffffc0000000000 RBX: 0000000000000001 RCX: ffffc9000c432000
RDX: 0000000000000002 RSI: ffffffff857d8dc1 RDI: 0000000000000005
kobject: 'loop4' (00000000b88abefc): kobject_uevent_env
RBP: ffff888066abfd08 R08: ffff888064ff43c0 R09: fffffbfff1264fcd
R10: fffffbfff1264fcc R11: ffffffff89327e63 R12: 0000000000000000
R13: ffff888098d9c800 R14: 0000000000000012 R15: 0000000000000000
kobject: 'loop4' (00000000b88abefc): fill_kobj_path: path  
= '/devices/virtual/block/loop4'
FS:  00007f02a40cf700(0000) GS:ffff8880ae900000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00000000004563fa CR3: 000000009ae04000 CR4: 00000000001406e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
  __sctp_hash_endpoint net/sctp/input.c:758 [inline]
  sctp_hash_endpoint+0x523/0x5d0 net/sctp/input.c:786
  sctp_listen_start net/sctp/socket.c:7967 [inline]
  sctp_inet_listen+0x5b2/0x880 net/sctp/socket.c:8022
kobject: 'loop5' (0000000099e34deb): kobject_uevent_env
  __sys_listen+0x19b/0x270 net/socket.c:1515
kobject: 'loop5' (0000000099e34deb): fill_kobj_path: path  
= '/devices/virtual/block/loop5'
  __do_sys_listen net/socket.c:1524 [inline]
  __se_sys_listen net/socket.c:1522 [inline]
  __x64_sys_listen+0x54/0x80 net/socket.c:1522
  do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290
  entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x457e29
kobject: 'loop1' (00000000259faa1c): kobject_uevent_env
Code: ad b8 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7  
48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff  
ff 0f 83 7b b8 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f02a40cec78 EFLAGS: 00000246 ORIG_RAX: 0000000000000032
kobject: 'loop1' (00000000259faa1c): fill_kobj_path: path  
= '/devices/virtual/block/loop1'
RAX: ffffffffffffffda RBX: 0000000000000002 RCX: 0000000000457e29
RDX: 0000000000000000 RSI: 0000000100000001 RDI: 0000000000000005
RBP: 000000000073bf00 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f02a40cf6d4
R13: 00000000004c3a2d R14: 00000000004d6940 R15: 00000000ffffffff
Modules linked in:
---[ end trace 3ce5847aad8cc1f0 ]---
RIP: 0010:reuseport_add_sock+0x187/0x8f0 net/core/sock_reuseport.c:170
Code: e8 ce 4e f2 fb 66 83 fb 01 0f 85 54 06 00 00 e8 5f 4d f2 fb 4d 8d 74  
24 12 48 b8 00 00 00 00 00 fc ff df 4c 89 f2 48 c1 ea 03 <0f> b6 14 02 4c  
89 f0 83 e0 07 83 c0 01 38 d0 7c 08 84 d2 0f 85 fc
RSP: 0018:ffff888066abfca0 EFLAGS: 00010202
RAX: dffffc0000000000 RBX: 0000000000000001 RCX: ffffc9000c432000
RDX: 0000000000000002 RSI: ffffffff857d8dc1 RDI: 0000000000000005
RBP: ffff888066abfd08 R08: ffff888064ff43c0 R09: fffffbfff1264fcd
R10: fffffbfff1264fcc R11: ffffffff89327e63 R12: 0000000000000000
R13: ffff888098d9c800 R14: 0000000000000012 R15: 0000000000000000
FS:  00007f02a40cf700(0000) GS:ffff8880ae900000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00000000004563fa CR3: 000000009ae04000 CR4: 00000000001406e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400


---
This bug is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#bug-status-tracking for how to communicate with  
syzbot.

^ permalink raw reply

* general protection fault in rt_cache_valid
From: syzbot @ 2019-02-16  7:01 UTC (permalink / raw)
  To: davem, kuznet, linux-kernel, netdev, syzkaller-bugs, yoshfuji

Hello,

syzbot found the following crash on:

HEAD commit:    b71acb0e3721 Merge branch 'linus' of git://git.kernel.org/..
git tree:       net-next
console output: https://syzkaller.appspot.com/x/log.txt?x=1582bc30c00000
kernel config:  https://syzkaller.appspot.com/x/.config?x=b03c5892bb940c76
dashboard link: https://syzkaller.appspot.com/bug?extid=0290d2290a607e035ba1
compiler:       gcc (GCC) 9.0.0 20181231 (experimental)

Unfortunately, I don't have any reproducer for this crash yet.

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+0290d2290a607e035ba1@syzkaller.appspotmail.com

kasan: CONFIG_KASAN_INLINE enabled
kasan: GPF could be caused by NULL-ptr deref or user memory access
general protection fault: 0000 [#1] PREEMPT SMP KASAN
CPU: 1 PID: 2230 Comm: syz-executor0 Not tainted 4.20.0+ #3
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011
RIP: 0010:rt_cache_valid+0x85/0x250 net/ipv4/route.c:1510
Code: 04 25 28 00 00 00 48 89 45 d0 31 c0 e8 34 92 f1 fa 48 85 db 74 4a e8  
2a 92 f1 fa 48 8d 7b 3a 4c 8d 75 d8 48 89 f8 48 c1 e8 03 <42> 0f b6 14 28  
48 89 f8 83 e0 07 83 c0 01 38 d0 7c 08 84 d2 0f 85
kobject: 'loop3' (000000002d125388): kobject_uevent_env
RSP: 0018:ffff88809b24e0a8 EFLAGS: 00010207
RAX: 0000000000000024 RBX: 00000000000000eb RCX: ffffc90005df9000
RDX: 00000000000016a8 RSI: ffffffff869013e6 RDI: 0000000000000125
RBP: ffff88809b24e130 R08: ffff88806586e0c0 R09: ffffed1015ce5b90
R10: ffffed1015ce5b8f R11: ffff8880ae72dc7b R12: 1ffff11013649c15
R13: dffffc0000000000 R14: ffff88809b24e108 R15: 0000000000000000
FS:  00007f9fa034d700(0000) GS:ffff8880ae700000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b33722000 CR3: 000000008512a000 CR4: 00000000001406e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
  __mkroute_output net/ipv4/route.c:2260 [inline]
  ip_route_output_key_hash_rcu+0x952/0x3470 net/ipv4/route.c:2492
kobject: 'loop3' (000000002d125388): fill_kobj_path: path  
= '/devices/virtual/block/loop3'
kobject: 'loop5' (00000000a20c7830): kobject_uevent_env
  ip_route_output_key_hash+0x25d/0x400 net/ipv4/route.c:2321
kobject: 'loop5' (00000000a20c7830): fill_kobj_path: path  
= '/devices/virtual/block/loop5'
  icmp_route_lookup.constprop.0+0x458/0x18e0 net/ipv4/icmp.c:489
kobject: 'loop2' (000000009de45ca1): kobject_uevent_env
  icmp_send+0x12eb/0x1bc0 net/ipv4/icmp.c:714
kobject: 'loop2' (000000009de45ca1): fill_kobj_path: path  
= '/devices/virtual/block/loop2'
  ipv4_link_failure+0x2c/0x210 net/ipv4/route.c:1187
  dst_link_failure include/net/dst.h:427 [inline]
  vti_xmit net/ipv4/ip_vti.c:229 [inline]
  vti_tunnel_xmit+0x85a/0x1730 net/ipv4/ip_vti.c:264
  __netdev_start_xmit include/linux/netdevice.h:4382 [inline]
  netdev_start_xmit include/linux/netdevice.h:4391 [inline]
  xmit_one net/core/dev.c:3278 [inline]
  dev_hard_start_xmit+0x261/0xc70 net/core/dev.c:3294
kobject: 'loop2' (000000009de45ca1): kobject_uevent_env
kobject: 'loop2' (000000009de45ca1): fill_kobj_path: path  
= '/devices/virtual/block/loop2'
  __dev_queue_xmit+0x2f8a/0x3a60 net/core/dev.c:3864
kobject: 'loop1' (00000000f4ea9cf1): kobject_uevent_env
kobject: 'loop1' (00000000f4ea9cf1): fill_kobj_path: path  
= '/devices/virtual/block/loop1'
  dev_queue_xmit+0x18/0x20 net/core/dev.c:3897
  neigh_direct_output+0x16/0x20 net/core/neighbour.c:1511
kobject: 'loop1' (00000000f4ea9cf1): kobject_uevent_env
  neigh_output include/net/neighbour.h:508 [inline]
  ip_finish_output2+0xa35/0x1a00 net/ipv4/ip_output.c:229
kobject: 'loop1' (00000000f4ea9cf1): fill_kobj_path: path  
= '/devices/virtual/block/loop1'
  ip_finish_output+0x7e4/0xf60 net/ipv4/ip_output.c:317
  NF_HOOK_COND include/linux/netfilter.h:278 [inline]
  ip_output+0x226/0x880 net/ipv4/ip_output.c:405
  dst_output include/net/dst.h:444 [inline]
  ip_local_out+0xc4/0x1b0 net/ipv4/ip_output.c:124
  ip_send_skb+0x42/0xf0 net/ipv4/ip_output.c:1465
  udp_send_skb.isra.0+0x6b2/0x1160 net/ipv4/udp.c:891
  udp_sendmsg+0x2902/0x3a40 net/ipv4/udp.c:1178
  udpv6_sendmsg+0x1843/0x3550 net/ipv6/udp.c:1279
kobject: 'loop4' (000000007ece3fce): kobject_uevent_env
kobject: 'loop4' (000000007ece3fce): fill_kobj_path: path  
= '/devices/virtual/block/loop4'
  inet_sendmsg+0x1af/0x740 net/ipv4/af_inet.c:798
  sock_sendmsg_nosec net/socket.c:621 [inline]
  sock_sendmsg+0xdd/0x130 net/socket.c:631
  ___sys_sendmsg+0x409/0x910 net/socket.c:2116
  __sys_sendmmsg+0x246/0x6f0 net/socket.c:2211
  __do_sys_sendmmsg net/socket.c:2240 [inline]
  __se_sys_sendmmsg net/socket.c:2237 [inline]
  __x64_sys_sendmmsg+0x9d/0x100 net/socket.c:2237
  do_syscall_64+0x1a3/0x800 arch/x86/entry/common.c:290
  entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x457ec9
Code: 6d b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7  
48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff  
ff 0f 83 3b b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f9fa034cc78 EFLAGS: 00000246 ORIG_RAX: 0000000000000133
RAX: ffffffffffffffda RBX: 0000000000000004 RCX: 0000000000457ec9
RDX: 00000000000004ff RSI: 00000000200092c0 RDI: 0000000000000004
RBP: 000000000073bf00 R08: 0000000000000000 R09: 0000000000000000
kobject: 'loop4' (000000007ece3fce): kobject_uevent_env
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f9fa034d6d4
R13: 00000000004c4ce5 R14: 00000000004d85d8 R15: 00000000ffffffff
Modules linked in:
---[ end trace bf211f6e476e0c45 ]---
RIP: 0010:rt_cache_valid+0x85/0x250 net/ipv4/route.c:1510
kobject: 'loop4' (000000007ece3fce): fill_kobj_path: path  
= '/devices/virtual/block/loop4'
Code: 04 25 28 00 00 00 48 89 45 d0 31 c0 e8 34 92 f1 fa 48 85 db 74 4a e8  
2a 92 f1 fa 48 8d 7b 3a 4c 8d 75 d8 48 89 f8 48 c1 e8 03 <42> 0f b6 14 28  
48 89 f8 83 e0 07 83 c0 01 38 d0 7c 08 84 d2 0f 85
RSP: 0018:ffff88809b24e0a8 EFLAGS: 00010207
RAX: 0000000000000024 RBX: 00000000000000eb RCX: ffffc90005df9000
RDX: 00000000000016a8 RSI: ffffffff869013e6 RDI: 0000000000000125
RBP: ffff88809b24e130 R08: ffff88806586e0c0 R09: ffffed1015ce5b90
kobject: 'loop5' (00000000a20c7830): kobject_uevent_env
R10: ffffed1015ce5b8f R11: ffff8880ae72dc7b R12: 1ffff11013649c15
R13: dffffc0000000000 R14: ffff88809b24e108 R15: 0000000000000000
FS:  00007f9fa034d700(0000) GS:ffff8880ae700000(0000) knlGS:0000000000000000
kobject: 'loop5' (00000000a20c7830): fill_kobj_path: path  
= '/devices/virtual/block/loop5'
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b33722000 CR3: 000000008512a000 CR4: 00000000001406e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400


---
This bug is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#bug-status-tracking for how to communicate with  
syzbot.

^ permalink raw reply

* WARNING in __vunmap
From: syzbot @ 2019-02-16  7:01 UTC (permalink / raw)
  To: davem, herbert, linux-kernel, netdev, steffen.klassert,
	syzkaller-bugs

Hello,

syzbot found the following crash on:

HEAD commit:    a048a07d7f45 powerpc/64s: Add support for a store forwardi..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1418d5a7800000
kernel config:  https://syzkaller.appspot.com/x/.config?x=982e2df1b9e60b02
dashboard link: https://syzkaller.appspot.com/bug?extid=5ec9bb042ddfe9644773
compiler:       gcc (GCC) 8.0.1 20180413 (experimental)

Unfortunately, I don't have any reproducer for this crash yet.

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+5ec9bb042ddfe9644773@syzkaller.appspotmail.com

------------[ cut here ]------------
Trying to vfree() nonexistent vm area (0000000094b55709)
WARNING: CPU: 1 PID: 8605 at mm/vmalloc.c:1525 __vunmap+0x324/0x3c0  
mm/vmalloc.c:1524
Kernel panic - not syncing: panic_on_warn set ...

CPU: 1 PID: 8605 Comm: syz-executor7 Not tainted 4.17.0-rc6+ #63
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011
Call Trace:
  __dump_stack lib/dump_stack.c:77 [inline]
  dump_stack+0x1b9/0x294 lib/dump_stack.c:113
  panic+0x22f/0x4de kernel/panic.c:184
  __warn.cold.8+0x163/0x1b3 kernel/panic.c:536
  report_bug+0x252/0x2d0 lib/bug.c:186
  fixup_bug arch/x86/kernel/traps.c:178 [inline]
  do_error_trap+0x1de/0x490 arch/x86/kernel/traps.c:296
  do_invalid_op+0x1b/0x20 arch/x86/kernel/traps.c:315
  invalid_op+0x14/0x20 arch/x86/entry/entry_64.S:992
RIP: 0010:__vunmap+0x324/0x3c0 mm/vmalloc.c:1524
RSP: 0018:ffff88018273f2b0 EFLAGS: 00010286
RAX: 0000000000000038 RBX: 0000000000000000 RCX: ffffc90003ed8000
RDX: 0000000000003b55 RSI: ffffffff81610961 RDI: ffff88018273ee10
RBP: ffff88018273f2f0 R08: ffff8801ab1a0340 R09: 0000000000000006
R10: ffff8801ab1a0340 R11: 0000000000000000 R12: ffffc90014122000
R13: 0000000000000001 R14: fffffbfff12f7f76 R15: 000060fe24e7fae8
  vfree+0x68/0x100 mm/vmalloc.c:1606
  ipcomp_free_scratches+0xbb/0x150 net/xfrm/xfrm_ipcomp.c:216
  ipcomp_free_data net/xfrm/xfrm_ipcomp.c:325 [inline]
  ipcomp_init_state+0x8cf/0xc00 net/xfrm/xfrm_ipcomp.c:377
  ipcomp4_init_state+0x110/0xb30 net/ipv4/ipcomp.c:137
  __xfrm_init_state+0x60e/0x1030 net/xfrm/xfrm_state.c:2277
  xfrm_init_state+0x1e/0x80 net/xfrm/xfrm_state.c:2303
  pfkey_msg2xfrm_state net/key/af_key.c:1307 [inline]
  pfkey_add+0x1c86/0x2eb0 net/key/af_key.c:1524
  pfkey_process+0x83d/0x980 net/key/af_key.c:2844
  pfkey_sendmsg+0x5f4/0x1050 net/key/af_key.c:3683
  sock_sendmsg_nosec net/socket.c:629 [inline]
  sock_sendmsg+0xd5/0x120 net/socket.c:639
  ___sys_sendmsg+0x805/0x940 net/socket.c:2117
  __sys_sendmsg+0x115/0x270 net/socket.c:2155
  __do_sys_sendmsg net/socket.c:2164 [inline]
  __se_sys_sendmsg net/socket.c:2162 [inline]
  __x64_sys_sendmsg+0x78/0xb0 net/socket.c:2162
  do_syscall_64+0x1b1/0x800 arch/x86/entry/common.c:287
  entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x455a09
RSP: 002b:00007fe6fd709c68 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007fe6fd70a6d4 RCX: 0000000000455a09
RDX: 0000000000000000 RSI: 0000000020f56000 RDI: 0000000000000014
RBP: 000000000072bea0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff
R13: 000000000000059d R14: 00000000006fc758 R15: 0000000000000000
Dumping ftrace buffer:
    (ftrace buffer empty)
Kernel Offset: disabled
Rebooting in 86400 seconds..


---
This bug is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#bug-status-tracking for how to communicate with  
syzbot.

^ permalink raw reply

* Re: [RFC PATCH] bonding: use mutex lock in bond_get_stats()
From: Kefeng Wang @ 2019-02-16  5:35 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: netdev, Willem de Bruijn, David S . Miller, Jay Vosburgh,
	Veaceslav Falico, weiyongjun1
In-Reply-To: <CANn89iJgtG=emiLUjZrmZmpQogauOvUNtqYukQZnRbRZ=zuLUA@mail.gmail.com>



On 2019/2/15 21:57, Eric Dumazet wrote:
> On Fri, Feb 15, 2019 at 5:37 AM Kefeng Wang <wangkefeng.wang@huawei.com> wrote:
>>
>> With CONFIG_DEBUG_SPINLOCK=y, we find following stack,
>>
>>  BUG: spinlock wrong CPU on CPU#0, ip/16047
>>   lock: 0xffff803f5febc998, .magic: dead4ead, .owner: ip/16047, .owner_cpu: 0
>>  CPU: 1 PID: 16047 Comm: ip Kdump: loaded Tainted: G            E 4.19.12.aarch64 #1
>>  Hardware name: Huawei TaiShan 2280 V2/BC82AMDA, BIOS TA BIOS TaiShan 2280 V2 - B900 01/29/2019
>>  Call trace:
>>   dump_backtrace+0x0/0x1c0
>>   show_stack+0x24/0x30
>>   dump_stack+0x90/0xbc
>>   spin_dump+0x84/0xa8
>>   do_raw_spin_unlock+0xf8/0x100
>>   _raw_spin_unlock+0x20/0x30
>>   bond_get_stats+0x110/0x140 [bonding]
>>   rtnl_fill_stats+0x50/0x150
>>   rtnl_fill_ifinfo+0x4d4/0xd18
>>   rtnl_dump_ifinfo+0x200/0x3a8
>>   netlink_dump+0x100/0x2b0
>>   netlink_recvmsg+0x310/0x3e8
>>   sock_recvmsg+0x58/0x68
>>   ___sys_recvmsg+0xd0/0x278
>>   __sys_recvmsg+0x74/0xd0
>>   __arm64_sys_recvmsg+0x2c/0x38
>>   el0_svc_common+0x7c/0x118
>>   el0_svc_handler+0x30/0x40
>>   el0_svc+0x8/0xc
>>
>> and then lead to softlockup issue, fix this by using mutex lock instead
>> of spin lock.
>>
>> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
>> ---
>>
>> Not sure if this is right fix, please correct me if I'm wrong.
>>
> 
> Make sure to also try :
> 
> cat /proc/net/dev

Yes, no regression with this patch in our test or 'cat /proc/net/dev'

> 
> .
> 


^ permalink raw reply

* Re: [PATCH net-next v3 0/9] net: Get rid of switchdev_port_attr_get()
From: Florian Fainelli @ 2019-02-16  5:00 UTC (permalink / raw)
  To: netdev, David Miller
  Cc: idosch, linux-kernel, devel, bridge, jiri, andrew, vivien.didelot
In-Reply-To: <20190216045556.3514-1-f.fainelli@gmail.com>



On 2/15/2019 8:55 PM, Florian Fainelli wrote:
> Hi all,
> 
> This patch series splits the removal of the switchdev_ops that was
> proposed a few times before and first tackles the easy part which is the
> removal of the single call to switchdev_port_attr_get() within the
> bridge code.
> 
> As suggestd by Ido, this patch series adds a
> SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS which is used in the same
> context as the caller of switchdev_port_attr_set(), so not deferred, and
> then the operation is carried out in deferred context with setting a
> support bridge port flag.
> 
> Follow-up patches will do the switchdev_ops removal after introducing
> the proper helpers for the switchdev blocking notifier to work across
> stacked devices (unlike the previous submissions).

OK, I really need to use the long weekend break here and stop sending
stale patches series apologies everyone, work will resume when I have
put my head, hands and keyboard back together.
-- 
Florian

^ permalink raw reply

* [PATCH net-next v3 0/9] net: Get rid of switchdev_port_attr_get()
From: Florian Fainelli @ 2019-02-16  4:55 UTC (permalink / raw)
  To: netdev
  Cc: Florian Fainelli, idosch, linux-kernel, devel, bridge, jiri,
	andrew, vivien.didelot

Hi all,

This patch series splits the removal of the switchdev_ops that was
proposed a few times before and first tackles the easy part which is the
removal of the single call to switchdev_port_attr_get() within the
bridge code.

As suggestd by Ido, this patch series adds a
SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS which is used in the same
context as the caller of switchdev_port_attr_set(), so not deferred, and
then the operation is carried out in deferred context with setting a
support bridge port flag.

Follow-up patches will do the switchdev_ops removal after introducing
the proper helpers for the switchdev blocking notifier to work across
stacked devices (unlike the previous submissions).

Changes in v3:
- fixed build failure in mlxsw/spectrum_switchdev.c due to left over
  argument

- fixed unused variable in rocker

Changes in v2:

- differentiate callers not supporting switchdev_port_attr_set() from
  the driver not being able to support specific bridge flags

- pass "mask" instead of "flags" for the PRE_BRIDGE_FLAGS check

- skip prepare phase for PRE_BRIDGE_FLAGS

- corrected documentation a bit more

- tested bridge_vlan_aware.sh with veth/VRF

Florian Fainelli (9):
  Documentation: networking: switchdev: Update port parent ID section
  switchdev: Add SWITCHDEV_PORT_ATTR_SET, SWITCHDEV_PORT_ATTR_GET
  rocker: Handle SWITCHDEV_PORT_ATTR_GET/SET
  mlxsw: spectrum_switchdev: Handle SWITCHDEV_PORT_ATTR_GET/SET
  net: mscc: ocelot: Handle SWITCHDEV_PORT_ATTR_GET/SET
  staging: fsl-dpaa2: ethsw: Handle SWITCHDEV_PORT_ATTR_GET/SET
  net: dsa: Handle SWITCHDEV_PORT_ATTR_GET/SET
  net: switchdev: Replace port attr get/set SDO with a notification
  net: Remove switchdev_ops

 Documentation/networking/switchdev.txt        |  10 +-
 .../net/ethernet/mellanox/mlxsw/spectrum.c    |  12 --
 .../net/ethernet/mellanox/mlxsw/spectrum.h    |   2 -
 .../mellanox/mlxsw/spectrum_switchdev.c       |  36 +++---
 drivers/net/ethernet/mscc/ocelot.c            |  26 ++++-
 drivers/net/ethernet/rocker/rocker_main.c     |  30 ++++-
 drivers/staging/fsl-dpaa2/ethsw/ethsw.c       |  30 ++++-
 include/linux/netdevice.h                     |   3 -
 include/net/switchdev.h                       |  28 ++---
 net/dsa/slave.c                               |  30 ++++-
 net/switchdev/switchdev.c                     | 107 ++++++------------
 11 files changed, 168 insertions(+), 146 deletions(-)

-- 
2.19.1


^ permalink raw reply

* [PATCH net-next v3 1/9] Documentation: networking: switchdev: Update port parent ID section
From: Florian Fainelli @ 2019-02-16  4:55 UTC (permalink / raw)
  To: netdev
  Cc: Florian Fainelli, idosch, linux-kernel, devel, bridge, jiri,
	andrew, vivien.didelot
In-Reply-To: <20190216045556.3514-1-f.fainelli@gmail.com>

Update the section about switchdev drivers having to implement a
switchdev_port_attr_get() function to return
SWITCHDEV_ATTR_ID_PORT_PARENT_ID since that is no longer valid after
commit bccb30254a4a ("net: Get rid of
SWITCHDEV_ATTR_ID_PORT_PARENT_ID").

Fixes: bccb30254a4a ("net: Get rid of SWITCHDEV_ATTR_ID_PORT_PARENT_ID")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 Documentation/networking/switchdev.txt | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/Documentation/networking/switchdev.txt b/Documentation/networking/switchdev.txt
index f3244d87512a..2842f63ad47b 100644
--- a/Documentation/networking/switchdev.txt
+++ b/Documentation/networking/switchdev.txt
@@ -92,11 +92,11 @@ device.
 Switch ID
 ^^^^^^^^^
 
-The switchdev driver must implement the switchdev op switchdev_port_attr_get
-for SWITCHDEV_ATTR_ID_PORT_PARENT_ID for each port netdev, returning the same
-physical ID for each port of a switch.  The ID must be unique between switches
-on the same system.  The ID does not need to be unique between switches on
-different systems.
+The switchdev driver must implement the net_device operation
+ndo_get_port_parent_id for each port netdev,  returning the same physical ID
+for each port of a switch. The ID must be unique between switches on the same
+system. The ID does not need to be unique between switches on different
+systems.
 
 The switch ID is used to locate ports on a switch and to know if aggregated
 ports belong to the same switch.
-- 
2.19.1


^ permalink raw reply related

* [PATCH net-next v3 3/9] rocker: Handle SWITCHDEV_PORT_ATTR_GET/SET
From: Florian Fainelli @ 2019-02-16  4:55 UTC (permalink / raw)
  To: netdev
  Cc: Florian Fainelli, idosch, linux-kernel, devel, bridge, jiri,
	andrew, vivien.didelot
In-Reply-To: <20190216045556.3514-1-f.fainelli@gmail.com>

Following patches will change the way we communicate getting or setting
a port's attribute and use a blocking notifier to perform those tasks.

Prepare rocker to support receiving notifier events targeting
SWITCHDEV_PORT_ATTR_GET/SET and simply translate that into the existing
rocker_port_attr_{set,get} calls.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/ethernet/rocker/rocker_main.c | 24 +++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/drivers/net/ethernet/rocker/rocker_main.c b/drivers/net/ethernet/rocker/rocker_main.c
index 66f72f8c46e5..591008c8fa74 100644
--- a/drivers/net/ethernet/rocker/rocker_main.c
+++ b/drivers/net/ethernet/rocker/rocker_main.c
@@ -2835,6 +2835,27 @@ rocker_switchdev_port_obj_event(unsigned long event, struct net_device *netdev,
 	return notifier_from_errno(err);
 }
 
+static int
+rocker_switchdev_port_attr_event(unsigned long event, struct net_device *netdev,
+				 struct switchdev_notifier_port_attr_info
+				 *port_attr_info)
+{
+	int err = -EOPNOTSUPP;
+
+	switch (event) {
+	case SWITCHDEV_PORT_ATTR_SET:
+		err = rocker_port_attr_set(netdev, port_attr_info->attr,
+					   port_attr_info->trans);
+		break;
+	case SWITCHDEV_PORT_ATTR_GET:
+		err = rocker_port_attr_get(netdev, port_attr_info->attr);
+		break;
+	}
+
+	port_attr_info->handled = true;
+	return notifier_from_errno(err);
+}
+
 static int rocker_switchdev_blocking_event(struct notifier_block *unused,
 					   unsigned long event, void *ptr)
 {
@@ -2847,6 +2868,9 @@ static int rocker_switchdev_blocking_event(struct notifier_block *unused,
 	case SWITCHDEV_PORT_OBJ_ADD:
 	case SWITCHDEV_PORT_OBJ_DEL:
 		return rocker_switchdev_port_obj_event(event, dev, ptr);
+	case SWITCHDEV_PORT_ATTR_SET:
+	case SWITCHDEV_PORT_ATTR_GET:
+		return rocker_switchdev_port_attr_event(event, dev, ptr);
 	}
 
 	return NOTIFY_DONE;
-- 
2.19.1


^ permalink raw reply related

* [PATCH net-next v3 2/9] switchdev: Add SWITCHDEV_PORT_ATTR_SET, SWITCHDEV_PORT_ATTR_GET
From: Florian Fainelli @ 2019-02-16  4:55 UTC (permalink / raw)
  To: netdev
  Cc: Florian Fainelli, idosch, linux-kernel, devel, bridge, jiri,
	andrew, vivien.didelot
In-Reply-To: <20190216045556.3514-1-f.fainelli@gmail.com>

In preparation for allowing switchdev enabled drivers to veto specific
attribute settings from within the context of the caller, introduce a
new switchdev notifier type for port attributes.

Suggested-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 include/net/switchdev.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/include/net/switchdev.h b/include/net/switchdev.h
index 5e87b54c5dc5..b8becabbef38 100644
--- a/include/net/switchdev.h
+++ b/include/net/switchdev.h
@@ -143,6 +143,9 @@ enum switchdev_notifier_type {
 	SWITCHDEV_VXLAN_FDB_ADD_TO_DEVICE,
 	SWITCHDEV_VXLAN_FDB_DEL_TO_DEVICE,
 	SWITCHDEV_VXLAN_FDB_OFFLOADED,
+
+	SWITCHDEV_PORT_ATTR_SET, /* Blocking. */
+	SWITCHDEV_PORT_ATTR_GET, /* Blocking. */
 };
 
 struct switchdev_notifier_info {
@@ -165,6 +168,13 @@ struct switchdev_notifier_port_obj_info {
 	bool handled;
 };
 
+struct switchdev_notifier_port_attr_info {
+	struct switchdev_notifier_info info; /* must be first */
+	struct switchdev_attr *attr;
+	struct switchdev_trans *trans;
+	bool handled;
+};
+
 static inline struct net_device *
 switchdev_notifier_info_to_dev(const struct switchdev_notifier_info *info)
 {
-- 
2.19.1


^ permalink raw reply related

* [PATCH net-next v3 5/9] net: mscc: ocelot: Handle SWITCHDEV_PORT_ATTR_GET/SET
From: Florian Fainelli @ 2019-02-16  4:55 UTC (permalink / raw)
  To: netdev
  Cc: Florian Fainelli, idosch, linux-kernel, devel, bridge, jiri,
	andrew, vivien.didelot
In-Reply-To: <20190216045556.3514-1-f.fainelli@gmail.com>

Following patches will change the way we communicate getting or setting
a port's attribute and use a blocking notifier to perform those tasks.

Prepare ocelot to support receiving notifier events targeting
SWITCHDEV_PORT_ATTR_GET/SET and simply translate that into the existing
ocelot_port_attr_{set,get} calls.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/ethernet/mscc/ocelot.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c
index 195306d05bcd..850a49033a30 100644
--- a/drivers/net/ethernet/mscc/ocelot.c
+++ b/drivers/net/ethernet/mscc/ocelot.c
@@ -1582,6 +1582,24 @@ struct notifier_block ocelot_netdevice_nb __read_mostly = {
 };
 EXPORT_SYMBOL(ocelot_netdevice_nb);
 
+static int
+ocelot_switchdev_port_attr_event(unsigned long event,
+		struct net_device *netdev,
+		struct switchdev_notifier_port_attr_info *port_attr_info)
+{
+	int err = -EOPNOTSUPP;
+
+	switch (event) {
+	case SWITCHDEV_PORT_ATTR_SET:
+		err = ocelot_port_attr_set(netdev, port_attr_info->attr,
+					   port_attr_info->trans);
+		break;
+	}
+
+	port_attr_info->handled = true;
+	return notifier_from_errno(err);
+}
+
 static int ocelot_switchdev_blocking_event(struct notifier_block *unused,
 					   unsigned long event, void *ptr)
 {
@@ -1600,6 +1618,9 @@ static int ocelot_switchdev_blocking_event(struct notifier_block *unused,
 						    ocelot_netdevice_dev_check,
 						    ocelot_port_obj_del);
 		return notifier_from_errno(err);
+	case SWITCHDEV_PORT_ATTR_SET:
+	case SWITCHDEV_PORT_ATTR_GET: /* fallthrough */
+		return ocelot_switchdev_port_attr_event(event, dev, ptr);
 	}
 
 	return NOTIFY_DONE;
-- 
2.19.1


^ permalink raw reply related

* [PATCH net-next v3 7/9] net: dsa: Handle SWITCHDEV_PORT_ATTR_GET/SET
From: Florian Fainelli @ 2019-02-16  4:55 UTC (permalink / raw)
  To: netdev
  Cc: Florian Fainelli, idosch, linux-kernel, devel, bridge, jiri,
	andrew, vivien.didelot
In-Reply-To: <20190216045556.3514-1-f.fainelli@gmail.com>

Following patches will change the way we communicate getting or setting
a port's attribute and use a blocking notifier to perform those tasks.

Prepare DSA to support receiving notifier events targeting
SWITCHDEV_PORT_ATTR_GET/SET and simply translate that into the existing
dsa_slave_port_attr_{set,get} calls.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 net/dsa/slave.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 2e5e7c04821b..2a14a38f5f93 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -1558,6 +1558,27 @@ dsa_slave_switchdev_port_obj_event(unsigned long event,
 	return notifier_from_errno(err);
 }
 
+static int
+dsa_slave_switchdev_port_attr_event(unsigned long event,
+		struct net_device *netdev,
+		struct switchdev_notifier_port_attr_info *port_attr_info)
+{
+	int err = -EOPNOTSUPP;
+
+	switch (event) {
+	case SWITCHDEV_PORT_ATTR_SET:
+		err = dsa_slave_port_attr_set(netdev, port_attr_info->attr,
+					      port_attr_info->trans);
+		break;
+	case SWITCHDEV_PORT_ATTR_GET:
+		err = dsa_slave_port_attr_get(netdev, port_attr_info->attr);
+		break;
+	}
+
+	port_attr_info->handled = true;
+	return notifier_from_errno(err);
+}
+
 static int dsa_slave_switchdev_blocking_event(struct notifier_block *unused,
 					      unsigned long event, void *ptr)
 {
@@ -1570,6 +1591,9 @@ static int dsa_slave_switchdev_blocking_event(struct notifier_block *unused,
 	case SWITCHDEV_PORT_OBJ_ADD: /* fall through */
 	case SWITCHDEV_PORT_OBJ_DEL:
 		return dsa_slave_switchdev_port_obj_event(event, dev, ptr);
+	case SWITCHDEV_PORT_ATTR_SET: /* fallthrough */
+	case SWITCHDEV_PORT_ATTR_GET:
+		return dsa_slave_switchdev_port_attr_event(event, dev, ptr);
 	}
 
 	return NOTIFY_DONE;
-- 
2.19.1


^ permalink raw reply related

* [PATCH net-next v3 8/9] net: switchdev: Replace port attr get/set SDO with a notification
From: Florian Fainelli @ 2019-02-16  4:55 UTC (permalink / raw)
  To: netdev
  Cc: Florian Fainelli, idosch, linux-kernel, devel, bridge, jiri,
	andrew, vivien.didelot
In-Reply-To: <20190216045556.3514-1-f.fainelli@gmail.com>

Drop switchdev_ops.switchdev_port_attr_get and _set. Drop the uses of
this field from all clients, which were migrated to use switchdev
notification in the previous patches.

Add a new function switchdev_port_attr_notify() that sends the switchdev
notifications SWITCHDEV_PORT_ATTR_GET and _SET.

Update switchdev_port_attr_get() to dispatch to this new function. Drop
__switchdev_port_attr_set() and update switchdev_port_attr_set()
likewise.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 net/switchdev/switchdev.c | 107 +++++++++++++-------------------------
 1 file changed, 37 insertions(+), 70 deletions(-)

diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c
index 7e1357db33d7..8fc3db2179f5 100644
--- a/net/switchdev/switchdev.c
+++ b/net/switchdev/switchdev.c
@@ -174,81 +174,31 @@ static int switchdev_deferred_enqueue(struct net_device *dev,
 	return 0;
 }
 
-/**
- *	switchdev_port_attr_get - Get port attribute
- *
- *	@dev: port device
- *	@attr: attribute to get
- */
-int switchdev_port_attr_get(struct net_device *dev, struct switchdev_attr *attr)
+static int switchdev_port_attr_notify(enum switchdev_notifier_type nt,
+				      struct net_device *dev,
+				      struct switchdev_attr *attr,
+				      struct switchdev_trans *trans)
 {
-	const struct switchdev_ops *ops = dev->switchdev_ops;
-	struct net_device *lower_dev;
-	struct list_head *iter;
-	struct switchdev_attr first = {
-		.id = SWITCHDEV_ATTR_ID_UNDEFINED
-	};
-	int err = -EOPNOTSUPP;
+	int err;
+	int rc;
 
-	if (ops && ops->switchdev_port_attr_get)
-		return ops->switchdev_port_attr_get(dev, attr);
+	struct switchdev_notifier_port_attr_info attr_info = {
+		.attr = attr,
+		.trans = trans,
+		.handled = false,
+	};
 
-	if (attr->flags & SWITCHDEV_F_NO_RECURSE)
+	rc = call_switchdev_blocking_notifiers(nt, dev, &attr_info.info, NULL);
+	err = notifier_to_errno(rc);
+	if (err) {
+		WARN_ON(!attr_info.handled);
 		return err;
-
-	/* Switch device port(s) may be stacked under
-	 * bond/team/vlan dev, so recurse down to get attr on
-	 * each port.  Return -ENODATA if attr values don't
-	 * compare across ports.
-	 */
-
-	netdev_for_each_lower_dev(dev, lower_dev, iter) {
-		err = switchdev_port_attr_get(lower_dev, attr);
-		if (err)
-			break;
-		if (first.id == SWITCHDEV_ATTR_ID_UNDEFINED)
-			first = *attr;
-		else if (memcmp(&first, attr, sizeof(*attr)))
-			return -ENODATA;
-	}
-
-	return err;
-}
-EXPORT_SYMBOL_GPL(switchdev_port_attr_get);
-
-static int __switchdev_port_attr_set(struct net_device *dev,
-				     const struct switchdev_attr *attr,
-				     struct switchdev_trans *trans)
-{
-	const struct switchdev_ops *ops = dev->switchdev_ops;
-	struct net_device *lower_dev;
-	struct list_head *iter;
-	int err = -EOPNOTSUPP;
-
-	if (ops && ops->switchdev_port_attr_set) {
-		err = ops->switchdev_port_attr_set(dev, attr, trans);
-		goto done;
-	}
-
-	if (attr->flags & SWITCHDEV_F_NO_RECURSE)
-		goto done;
-
-	/* Switch device port(s) may be stacked under
-	 * bond/team/vlan dev, so recurse down to set attr on
-	 * each port.
-	 */
-
-	netdev_for_each_lower_dev(dev, lower_dev, iter) {
-		err = __switchdev_port_attr_set(lower_dev, attr, trans);
-		if (err)
-			break;
 	}
 
-done:
-	if (err == -EOPNOTSUPP && attr->flags & SWITCHDEV_F_SKIP_EOPNOTSUPP)
-		err = 0;
+	if (!attr_info.handled)
+		return -EOPNOTSUPP;
 
-	return err;
+	return 0;
 }
 
 static int switchdev_port_attr_set_now(struct net_device *dev,
@@ -267,7 +217,9 @@ static int switchdev_port_attr_set_now(struct net_device *dev,
 	 */
 
 	trans.ph_prepare = true;
-	err = __switchdev_port_attr_set(dev, attr, &trans);
+	err = switchdev_port_attr_notify(SWITCHDEV_PORT_ATTR_SET,
+					 dev, (struct switchdev_attr *)attr,
+					 &trans);
 	if (err) {
 		/* Prepare phase failed: abort the transaction.  Any
 		 * resources reserved in the prepare phase are
@@ -286,7 +238,9 @@ static int switchdev_port_attr_set_now(struct net_device *dev,
 	 */
 
 	trans.ph_prepare = false;
-	err = __switchdev_port_attr_set(dev, attr, &trans);
+	err = switchdev_port_attr_notify(SWITCHDEV_PORT_ATTR_SET,
+					 dev, (struct switchdev_attr *)attr,
+					 &trans);
 	WARN(err, "%s: Commit of attribute (id=%d) failed.\n",
 	     dev->name, attr->id);
 	switchdev_trans_items_warn_destroy(dev, &trans);
@@ -338,6 +292,19 @@ int switchdev_port_attr_set(struct net_device *dev,
 }
 EXPORT_SYMBOL_GPL(switchdev_port_attr_set);
 
+/**
+ *	switchdev_port_attr_get - Get port attribute
+ *
+ *	@dev: port device
+ *	@attr: attribute to get
+ */
+int switchdev_port_attr_get(struct net_device *dev, struct switchdev_attr *attr)
+{
+	return switchdev_port_attr_notify(SWITCHDEV_PORT_ATTR_GET, dev,
+					  attr, NULL);
+}
+EXPORT_SYMBOL_GPL(switchdev_port_attr_get);
+
 static size_t switchdev_obj_size(const struct switchdev_obj *obj)
 {
 	switch (obj->id) {
-- 
2.19.1


^ permalink raw reply related

* [PATCH net-next v3 9/9] net: Remove switchdev_ops
From: Florian Fainelli @ 2019-02-16  4:55 UTC (permalink / raw)
  To: netdev
  Cc: Florian Fainelli, idosch, linux-kernel, devel, bridge, jiri,
	andrew, vivien.didelot
In-Reply-To: <20190216045556.3514-1-f.fainelli@gmail.com>

Now that we have converted all possible callers to using a switchdev
notifier for attributes we do not have a need for implementing
switchdev_ops anymore, and this can be removed from all drivers the
net_device structure.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 12 ------------
 drivers/net/ethernet/mellanox/mlxsw/spectrum.h |  2 --
 .../mellanox/mlxsw/spectrum_switchdev.c        | 13 -------------
 drivers/net/ethernet/mscc/ocelot.c             |  5 -----
 drivers/net/ethernet/rocker/rocker_main.c      |  6 ------
 drivers/staging/fsl-dpaa2/ethsw/ethsw.c        |  6 ------
 include/linux/netdevice.h                      |  3 ---
 include/net/switchdev.h                        | 18 ------------------
 net/dsa/slave.c                                |  6 ------
 9 files changed, 71 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
index 7c9745cecbbd..619965abab43 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
@@ -3220,7 +3220,6 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port,
 	}
 	mlxsw_sp_port->default_vlan = mlxsw_sp_port_vlan;
 
-	mlxsw_sp_port_switchdev_init(mlxsw_sp_port);
 	mlxsw_sp->ports[local_port] = mlxsw_sp_port;
 	err = register_netdev(dev);
 	if (err) {
@@ -3237,7 +3236,6 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port,
 
 err_register_netdev:
 	mlxsw_sp->ports[local_port] = NULL;
-	mlxsw_sp_port_switchdev_fini(mlxsw_sp_port);
 	mlxsw_sp_port_vlan_destroy(mlxsw_sp_port_vlan);
 err_port_vlan_create:
 err_port_pvid_set:
@@ -3280,7 +3278,6 @@ static void mlxsw_sp_port_remove(struct mlxsw_sp *mlxsw_sp, u8 local_port)
 	mlxsw_core_port_clear(mlxsw_sp->core, local_port, mlxsw_sp);
 	unregister_netdev(mlxsw_sp_port->dev); /* This calls ndo_stop */
 	mlxsw_sp->ports[local_port] = NULL;
-	mlxsw_sp_port_switchdev_fini(mlxsw_sp_port);
 	mlxsw_sp_port_vlan_flush(mlxsw_sp_port, true);
 	mlxsw_sp_port_nve_fini(mlxsw_sp_port);
 	mlxsw_sp_tc_qdisc_fini(mlxsw_sp_port);
@@ -4001,12 +3998,6 @@ static int mlxsw_sp_init(struct mlxsw_core *mlxsw_core,
 		goto err_span_init;
 	}
 
-	err = mlxsw_sp_switchdev_init(mlxsw_sp);
-	if (err) {
-		dev_err(mlxsw_sp->bus_info->dev, "Failed to initialize switchdev\n");
-		goto err_switchdev_init;
-	}
-
 	err = mlxsw_sp_counter_pool_init(mlxsw_sp);
 	if (err) {
 		dev_err(mlxsw_sp->bus_info->dev, "Failed to init counter pool\n");
@@ -4077,8 +4068,6 @@ static int mlxsw_sp_init(struct mlxsw_core *mlxsw_core,
 err_afa_init:
 	mlxsw_sp_counter_pool_fini(mlxsw_sp);
 err_counter_pool_init:
-	mlxsw_sp_switchdev_fini(mlxsw_sp);
-err_switchdev_init:
 	mlxsw_sp_span_fini(mlxsw_sp);
 err_span_init:
 	mlxsw_sp_lag_fini(mlxsw_sp);
@@ -4141,7 +4130,6 @@ static void mlxsw_sp_fini(struct mlxsw_core *mlxsw_core)
 	mlxsw_sp_nve_fini(mlxsw_sp);
 	mlxsw_sp_afa_fini(mlxsw_sp);
 	mlxsw_sp_counter_pool_fini(mlxsw_sp);
-	mlxsw_sp_switchdev_fini(mlxsw_sp);
 	mlxsw_sp_span_fini(mlxsw_sp);
 	mlxsw_sp_lag_fini(mlxsw_sp);
 	mlxsw_sp_buffers_fini(mlxsw_sp);
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h
index ceebc91f4f1d..82e3e6dc81a1 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h
@@ -375,8 +375,6 @@ u32 mlxsw_sp_bytes_cells(const struct mlxsw_sp *mlxsw_sp, u32 bytes);
 /* spectrum_switchdev.c */
 int mlxsw_sp_switchdev_init(struct mlxsw_sp *mlxsw_sp);
 void mlxsw_sp_switchdev_fini(struct mlxsw_sp *mlxsw_sp);
-void mlxsw_sp_port_switchdev_init(struct mlxsw_sp_port *mlxsw_sp_port);
-void mlxsw_sp_port_switchdev_fini(struct mlxsw_sp_port *mlxsw_sp_port);
 int mlxsw_sp_rif_fdb_op(struct mlxsw_sp *mlxsw_sp, const char *mac, u16 fid,
 			bool adding);
 void
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
index c6d7bb70e8f2..fafd582c2fdc 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
@@ -1957,11 +1957,6 @@ static struct mlxsw_sp_port *mlxsw_sp_lag_rep_port(struct mlxsw_sp *mlxsw_sp,
 	return NULL;
 }
 
-static const struct switchdev_ops mlxsw_sp_port_switchdev_ops = {
-	.switchdev_port_attr_get	= mlxsw_sp_port_attr_get,
-	.switchdev_port_attr_set	= mlxsw_sp_port_attr_set,
-};
-
 static int
 mlxsw_sp_bridge_8021q_port_join(struct mlxsw_sp_bridge_device *bridge_device,
 				struct mlxsw_sp_bridge_port *bridge_port,
@@ -3576,11 +3571,3 @@ void mlxsw_sp_switchdev_fini(struct mlxsw_sp *mlxsw_sp)
 	kfree(mlxsw_sp->bridge);
 }
 
-void mlxsw_sp_port_switchdev_init(struct mlxsw_sp_port *mlxsw_sp_port)
-{
-	mlxsw_sp_port->dev->switchdev_ops = &mlxsw_sp_port_switchdev_ops;
-}
-
-void mlxsw_sp_port_switchdev_fini(struct mlxsw_sp_port *mlxsw_sp_port)
-{
-}
diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c
index 850a49033a30..21c73a0355d4 100644
--- a/drivers/net/ethernet/mscc/ocelot.c
+++ b/drivers/net/ethernet/mscc/ocelot.c
@@ -1324,10 +1324,6 @@ static int ocelot_port_obj_del(struct net_device *dev,
 	return ret;
 }
 
-static const struct switchdev_ops ocelot_port_switchdev_ops = {
-	.switchdev_port_attr_set	= ocelot_port_attr_set,
-};
-
 static int ocelot_port_bridge_join(struct ocelot_port *ocelot_port,
 				   struct net_device *bridge)
 {
@@ -1654,7 +1650,6 @@ int ocelot_probe_port(struct ocelot *ocelot, u8 port,
 
 	dev->netdev_ops = &ocelot_port_netdev_ops;
 	dev->ethtool_ops = &ocelot_ethtool_ops;
-	dev->switchdev_ops = &ocelot_port_switchdev_ops;
 
 	dev->hw_features |= NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_RXFCS;
 	dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
diff --git a/drivers/net/ethernet/rocker/rocker_main.c b/drivers/net/ethernet/rocker/rocker_main.c
index 591008c8fa74..16f045b06c55 100644
--- a/drivers/net/ethernet/rocker/rocker_main.c
+++ b/drivers/net/ethernet/rocker/rocker_main.c
@@ -2147,11 +2147,6 @@ static int rocker_port_obj_del(struct net_device *dev,
 	return err;
 }
 
-static const struct switchdev_ops rocker_port_switchdev_ops = {
-	.switchdev_port_attr_get	= rocker_port_attr_get,
-	.switchdev_port_attr_set	= rocker_port_attr_set,
-};
-
 struct rocker_fib_event_work {
 	struct work_struct work;
 	union {
@@ -2605,7 +2600,6 @@ static int rocker_probe_port(struct rocker *rocker, unsigned int port_number)
 	rocker_port_dev_addr_init(rocker_port);
 	dev->netdev_ops = &rocker_port_netdev_ops;
 	dev->ethtool_ops = &rocker_port_ethtool_ops;
-	dev->switchdev_ops = &rocker_port_switchdev_ops;
 	netif_tx_napi_add(dev, &rocker_port->napi_tx, rocker_port_poll_tx,
 			  NAPI_POLL_WEIGHT);
 	netif_napi_add(dev, &rocker_port->napi_rx, rocker_port_poll_rx,
diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
index bc9e7de07200..44831990239c 100644
--- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
+++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
@@ -932,11 +932,6 @@ static int swdev_port_obj_del(struct net_device *netdev,
 	return err;
 }
 
-static const struct switchdev_ops ethsw_port_switchdev_ops = {
-	.switchdev_port_attr_get	= swdev_port_attr_get,
-	.switchdev_port_attr_set	= swdev_port_attr_set,
-};
-
 /* For the moment, only flood setting needs to be updated */
 static int port_bridge_join(struct net_device *netdev,
 			    struct net_device *upper_dev)
@@ -1466,7 +1461,6 @@ static int ethsw_probe_port(struct ethsw_core *ethsw, u16 port_idx)
 	SET_NETDEV_DEV(port_netdev, dev);
 	port_netdev->netdev_ops = &ethsw_port_ops;
 	port_netdev->ethtool_ops = &ethsw_port_ethtool_ops;
-	port_netdev->switchdev_ops = &ethsw_port_switchdev_ops;
 
 	/* Set MTU limits */
 	port_netdev->min_mtu = ETH_MIN_MTU;
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 1fb733f38a47..a747456b9d23 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1836,9 +1836,6 @@ struct net_device {
 #endif
 	const struct net_device_ops *netdev_ops;
 	const struct ethtool_ops *ethtool_ops;
-#ifdef CONFIG_NET_SWITCHDEV
-	const struct switchdev_ops *switchdev_ops;
-#endif
 #ifdef CONFIG_NET_L3_MASTER_DEV
 	const struct l3mdev_ops	*l3mdev_ops;
 #endif
diff --git a/include/net/switchdev.h b/include/net/switchdev.h
index b8becabbef38..e9aa920aba57 100644
--- a/include/net/switchdev.h
+++ b/include/net/switchdev.h
@@ -113,21 +113,6 @@ void *switchdev_trans_item_dequeue(struct switchdev_trans *trans);
 
 typedef int switchdev_obj_dump_cb_t(struct switchdev_obj *obj);
 
-/**
- * struct switchdev_ops - switchdev operations
- *
- * @switchdev_port_attr_get: Get a port attribute (see switchdev_attr).
- *
- * @switchdev_port_attr_set: Set a port attribute (see switchdev_attr).
- */
-struct switchdev_ops {
-	int	(*switchdev_port_attr_get)(struct net_device *dev,
-					   struct switchdev_attr *attr);
-	int	(*switchdev_port_attr_set)(struct net_device *dev,
-					   const struct switchdev_attr *attr,
-					   struct switchdev_trans *trans);
-};
-
 enum switchdev_notifier_type {
 	SWITCHDEV_FDB_ADD_TO_BRIDGE = 1,
 	SWITCHDEV_FDB_DEL_TO_BRIDGE,
@@ -229,7 +214,6 @@ int switchdev_handle_port_obj_del(struct net_device *dev,
 			int (*del_cb)(struct net_device *dev,
 				      const struct switchdev_obj *obj));
 
-#define SWITCHDEV_SET_OPS(netdev, ops) ((netdev)->switchdev_ops = (ops))
 #else
 
 static inline void switchdev_deferred_process(void)
@@ -322,8 +306,6 @@ switchdev_handle_port_obj_del(struct net_device *dev,
 	return 0;
 }
 
-#define SWITCHDEV_SET_OPS(netdev, ops) do {} while (0)
-
 #endif
 
 #endif /* _LINUX_SWITCHDEV_H_ */
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 2a14a38f5f93..236b6a72dba3 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -1057,11 +1057,6 @@ static const struct net_device_ops dsa_slave_netdev_ops = {
 	.ndo_get_port_parent_id	= dsa_slave_get_port_parent_id,
 };
 
-static const struct switchdev_ops dsa_slave_switchdev_ops = {
-	.switchdev_port_attr_get	= dsa_slave_port_attr_get,
-	.switchdev_port_attr_set	= dsa_slave_port_attr_set,
-};
-
 static struct device_type dsa_type = {
 	.name	= "dsa",
 };
@@ -1321,7 +1316,6 @@ int dsa_slave_create(struct dsa_port *port)
 	eth_hw_addr_inherit(slave_dev, master);
 	slave_dev->priv_flags |= IFF_NO_QUEUE;
 	slave_dev->netdev_ops = &dsa_slave_netdev_ops;
-	slave_dev->switchdev_ops = &dsa_slave_switchdev_ops;
 	slave_dev->min_mtu = 0;
 	slave_dev->max_mtu = ETH_MAX_MTU;
 	SET_NETDEV_DEVTYPE(slave_dev, &dsa_type);
-- 
2.19.1


^ permalink raw reply related

* [PATCH net-next v3 6/9] staging: fsl-dpaa2: ethsw: Handle SWITCHDEV_PORT_ATTR_GET/SET
From: Florian Fainelli @ 2019-02-16  4:55 UTC (permalink / raw)
  To: netdev
  Cc: Florian Fainelli, idosch, linux-kernel, devel, bridge, jiri,
	andrew, vivien.didelot
In-Reply-To: <20190216045556.3514-1-f.fainelli@gmail.com>

Following patches will change the way we communicate getting or setting
a port's attribute and use a blocking notifier to perform those tasks.

Prepare ethsw to support receiving notifier events targeting
SWITCHDEV_PORT_ATTR_GET/SET and simply translate that into the existing
swdev_port_attr_{set,get} calls.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
index e559f4c25cf7..bc9e7de07200 100644
--- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
+++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
@@ -1111,6 +1111,27 @@ ethsw_switchdev_port_obj_event(unsigned long event, struct net_device *netdev,
 	return notifier_from_errno(err);
 }
 
+static int
+ethsw_switchdev_port_attr_event(unsigned long event,
+		struct net_device *netdev,
+		struct switchdev_notifier_port_attr_info *port_attr_info)
+{
+	int err = -EOPNOTSUPP;
+
+	switch (event) {
+	case SWITCHDEV_PORT_ATTR_SET:
+		err = swdev_port_attr_set(netdev, port_attr_info->attr,
+					  port_attr_info->trans);
+		break;
+	case SWITCHDEV_PORT_ATTR_GET:
+		err = swdev_port_attr_get(netdev, port_attr_info->attr);
+		break;
+	}
+
+	port_attr_info->handled = true;
+	return notifier_from_errno(err);
+}
+
 static int port_switchdev_blocking_event(struct notifier_block *unused,
 					 unsigned long event, void *ptr)
 {
@@ -1123,6 +1144,9 @@ static int port_switchdev_blocking_event(struct notifier_block *unused,
 	case SWITCHDEV_PORT_OBJ_ADD: /* fall through */
 	case SWITCHDEV_PORT_OBJ_DEL:
 		return ethsw_switchdev_port_obj_event(event, dev, ptr);
+	case SWITCHDEV_PORT_ATTR_SET:
+	case SWITCHDEV_PORT_ATTR_GET:
+		return ethsw_switchdev_port_attr_event(event, dev, ptr);
 	}
 
 	return NOTIFY_DONE;
-- 
2.19.1


^ permalink raw reply related

* [PATCH net-next v3 4/9] mlxsw: spectrum_switchdev: Handle SWITCHDEV_PORT_ATTR_GET/SET
From: Florian Fainelli @ 2019-02-16  4:55 UTC (permalink / raw)
  To: netdev
  Cc: Florian Fainelli, idosch, linux-kernel, devel, bridge, jiri,
	andrew, vivien.didelot
In-Reply-To: <20190216045556.3514-1-f.fainelli@gmail.com>

Following patches will change the way we communicate getting or setting
a port's attribute and use a blocking notifier to perform those tasks.

Prepare mlxsw to support receiving notifier events targeting
SWITCHDEV_PORT_ATTR_GET/SET and simply translate that into the existing
mlxsw_sp_port_attr_{set,get} calls.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 .../mellanox/mlxsw/spectrum_switchdev.c       | 23 +++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
index 95e37de3e48f..c6d7bb70e8f2 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
@@ -3443,6 +3443,26 @@ mlxsw_sp_switchdev_handle_vxlan_obj_del(struct net_device *vxlan_dev,
 	}
 }
 
+static int
+mlxsw_sp_switchdev_port_attr_event(unsigned long event, struct net_device *dev,
+		struct switchdev_notifier_port_attr_info *port_attr_info)
+{
+	int err = -EOPNOTSUPP;
+
+	switch (event) {
+	case SWITCHDEV_PORT_ATTR_SET:
+		err = mlxsw_sp_port_attr_set(dev, port_attr_info->attr,
+					     port_attr_info->trans);
+		break;
+	case SWITCHDEV_PORT_ATTR_GET:
+		err = mlxsw_sp_port_attr_get(dev, port_attr_info->attr);
+		break;
+	}
+
+	port_attr_info->handled = true;
+	return notifier_from_errno(err);
+}
+
 static int mlxsw_sp_switchdev_blocking_event(struct notifier_block *unused,
 					     unsigned long event, void *ptr)
 {
@@ -3466,6 +3486,9 @@ static int mlxsw_sp_switchdev_blocking_event(struct notifier_block *unused,
 							mlxsw_sp_port_dev_check,
 							mlxsw_sp_port_obj_del);
 		return notifier_from_errno(err);
+	case SWITCHDEV_PORT_ATTR_SET:
+	case SWITCHDEV_PORT_ATTR_GET:
+		return mlxsw_sp_switchdev_port_attr_event(event, dev, ptr);
 	}
 
 	return NOTIFY_DONE;
-- 
2.19.1


^ permalink raw reply related

* Re: [MERGE HELP] cls_tcindex.c
From: David Miller @ 2019-02-16  4:49 UTC (permalink / raw)
  To: xiyou.wangcong; +Cc: netdev, vladbu
In-Reply-To: <CAM_iQpXCfNYSbawk8tZa+4oXb3DOYRv04eDJ1V8OAEndO14MYw@mail.gmail.com>

From: Cong Wang <xiyou.wangcong@gmail.com>
Date: Fri, 15 Feb 2019 17:31:41 -0800

> I will cherry-pick the first two patches for net-next and send them to you.

Ok, thanks Cong.

^ permalink raw reply

* Re: [PATCH net-next v2 0/9] net: Get rid of switchdev_port_attr_get()
From: David Miller @ 2019-02-16  4:49 UTC (permalink / raw)
  To: f.fainelli
  Cc: netdev, idosch, linux-kernel, devel, bridge, jiri, andrew,
	vivien.didelot
In-Reply-To: <77c28e2d-cd29-4932-5cfe-64799c730ede@gmail.com>

From: Florian Fainelli <f.fainelli@gmail.com>
Date: Fri, 15 Feb 2019 16:37:38 -0800

> David, please ignore this version, I will repost one that actually
> builds, need to keep mangling with my kernel configuration and keep
> those drivers enabled...

Ok.

^ permalink raw reply

* Re: [PATCH net 0/5] net: dsa: b53: VLAN and L2 fixes
From: David Miller @ 2019-02-16  4:38 UTC (permalink / raw)
  To: f.fainelli; +Cc: netdev, andrew, vivien.didelot
In-Reply-To: <20190215201653.20988-1-f.fainelli@gmail.com>

From: Florian Fainelli <f.fainelli@gmail.com>
Date: Fri, 15 Feb 2019 12:16:48 -0800

> This patch series contains a collection of fixes to the b53 driver in
> order to:
> 
> - consistently program the same default VLAN ID when a port is bridged
>   or not
> - properly account for VLAN filtering being turned on/off and turning
>   on ingress VID checking accordingly
> - have SYSTEMPORT properly forward BPDU frames to the network stack
>   (which it did not)
> - do not assume that WoL is supported by the DSA master network device
>   we are connected to

Series applied, thanks.

^ permalink raw reply

* Re: [PATCH net-next 0/7] s390/qeth: updates 2019-02-15
From: David Miller @ 2019-02-16  4:35 UTC (permalink / raw)
  To: jwi; +Cc: netdev, linux-s390, schwidefsky, heiko.carstens, raspl, ubraun
In-Reply-To: <20190215182231.90709-1-jwi@linux.ibm.com>

From: Julian Wiedmann <jwi@linux.ibm.com>
Date: Fri, 15 Feb 2019 19:22:24 +0100

> please apply a few more qeth patches to net-next. Along with some smaller
> improvements, this revamps our code for the SW statistics that are exposed
> through ETHTOOL_GSTATS.

Applied, thanks.

^ permalink raw reply

* Re: [PATCH net-next] selftests: forwarding: Add some missing configuration symbols
From: David Miller @ 2019-02-16  4:32 UTC (permalink / raw)
  To: f.fainelli; +Cc: netdev, shuah, idosch, jiri, linux-kselftest, linux-kernel
In-Reply-To: <20190215181457.21101-1-f.fainelli@gmail.com>

From: Florian Fainelli <f.fainelli@gmail.com>
Date: Fri, 15 Feb 2019 10:14:52 -0800

> For the forwarding selftests to work, we need network namespaces when
> using veth/vrf otherwise ping/ping6 commands like these:
> 
> ip vrf exec vveth0 /bin/ping 192.0.2.2 -c 10 -i 0.1 -w 5
> 
> will fail because network namespaces may not be enabled.
> 
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

Applied.

^ permalink raw reply

* Re: [PATCH net] net: validate untrusted gso packets without csum offload
From: David Miller @ 2019-02-16  4:31 UTC (permalink / raw)
  To: willemdebruijn.kernel
  Cc: netdev, edumazet, jasowang, maximmi, willemb, syzkaller
In-Reply-To: <20190215171547.247018-1-willemdebruijn.kernel@gmail.com>

From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Date: Fri, 15 Feb 2019 12:15:47 -0500

> From: Willem de Bruijn <willemb@google.com>
> 
> Syzkaller again found a path to a kernel crash through bad gso input.
> By building an excessively large packet to cause an skb field to wrap.
> 
> If VIRTIO_NET_HDR_F_NEEDS_CSUM was set this would have been dropped in
> skb_partial_csum_set.
> 
> GSO packets that do not set checksum offload are suspicious and rare.
> Most callers of virtio_net_hdr_to_skb already pass them to
> skb_probe_transport_header.
> 
> Move that test forward, change it to detect parse failure and drop
> packets on failure as those cleary are not one of the legitimate
> VIRTIO_NET_HDR_GSO types.
> 
> Fixes: bfd5f4a3d605 ("packet: Add GSO/csum offload support.")
> Fixes: f43798c27684 ("tun: Allow GSO using virtio_net_hdr")
> Reported-by: syzbot <syzkaller@googlegroups.com>
> Signed-off-by: Willem de Bruijn <willemb@google.com>

Applied and queued up for -stable, thanks Willem.

> This captures a variety of bad gso packets, but to tighten further:
> 
> - drop SKB_GSO_DODGY packets with ipip/sit/.. , which cannot be legal.
>     by ipip_gso_segment wrappers around inet_gso_segment
>     expands on 121d57af308d ("gso: validate gso_type in GSO handlers")
> 
> - limit the number of ipv6 exthdrs allowed from dodgy sources.
>     not sure where to draw the line. but not at 64K ;)
> 
> - validate the network and transport protocol returned in
>     skb_probe_transport_header against the VIRTIO_NET_HDR_GSO type
> 
> - probe all dodgy GSO packets, also those that set checksum offload.
>     this will have a performance impact, discussed previously in
>     http://patchwork.ozlabs.org/patch/861874/
>     but it would have blocked this latest bug as well
> 
> All but the last one seem pretty uncontroversial to me. If no one
> objects I plan to send those to net-next.

No objections from me.

^ permalink raw reply

* Re: [PATCH net-next] net/ipv6: prefer rcu_access_pointer() over rcu_dereference()
From: David Miller @ 2019-02-16  4:26 UTC (permalink / raw)
  To: pabeni; +Cc: netdev, dsahern
In-Reply-To: <52d4aee68b816ce36c0d4f4398ae143a2ebbdba4.1550249827.git.pabeni@redhat.com>

From: Paolo Abeni <pabeni@redhat.com>
Date: Fri, 15 Feb 2019 18:15:37 +0100

> rt6_cache_allowed_for_pmtu() checks for rt->from presence, but
> it does not access the RCU protected pointer. We can use
> rcu_access_pointer() and clean-up the code a bit. No functional
> changes intended.
> 
> Signed-off-by: Paolo Abeni <pabeni@redhat.com>

Applied, thanks.

^ permalink raw reply

* Re: [PATCH] net: Fix for_each_netdev_feature on Big endian
From: David Miller @ 2019-02-16  4:24 UTC (permalink / raw)
  To: hauke.mehrtens; +Cc: netdev, jarod, hauke, stable
In-Reply-To: <20190215165854.25842-1-hauke.mehrtens@intel.com>

From: Hauke Mehrtens <hauke.mehrtens@intel.com>
Date: Fri, 15 Feb 2019 17:58:54 +0100

> The features attribute is of type u64 and stored in the native endianes on
> the system. The for_each_set_bit() macro takes a pointer to a 32 bit array
> and goes over the bits in this area. On little Endian systems this also
> works with an u64 as the most significant bit is on the highest address,
> but on big endian the words are swapped. When we expect bit 15 here we get
> bit 47 (15 + 32).
> 
> This patch converts it more or less to its own for_each_set_bit()
> implementation which works on 64 bit integers directly. This is then
> completely in host endianness and should work like expected.
> 
> Fixes: fd867d51f ("net/core: generic support for disabling netdev features down stack")
> Cc: stable@vger.kernel.org
> Signed-off-by: Hauke Mehrtens <hauke.mehrtens@intel.com>

Applied and queued up for -stable.

Please do not CC: stable for networking fixes, I handle -stable submissions
myself manually and this is documented in the netdev FAQ.

^ permalink raw reply

* Re: [PATCH] net: phy: xgmiitorgmii: Support generic PHY status read
From: David Miller @ 2019-02-16  4:21 UTC (permalink / raw)
  To: paul.kocialkowski
  Cc: netdev, linux-arm-kernel, linux-kernel, andrew, f.fainelli,
	hkallweit1, michal.simek, thomas.petazzoni
In-Reply-To: <20190215161708.18645-1-paul.kocialkowski@bootlin.com>

From: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Date: Fri, 15 Feb 2019 17:17:08 +0100

> Some PHY drivers like the generic one do not provide a read_status
> callback on their own but rely on genphy_read_status being called
> directly.
> 
> With the current code, this results in a NULL function pointer call.
> Call genphy_read_status instead when there is no specific callback.
> 
> Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>

Applied, thanks.

Unfortunately I only noticed your updated version with the Fixes tag
after pushing this version out.  I'll be more careful next time :)

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox