Skip to content
Snippets Groups Projects
  1. Dec 19, 2022
  2. Dec 14, 2022
    • Greg Kroah-Hartman's avatar
    • Frank Jungclaus's avatar
      can: esd_usb: Allow REC and TEC to return to zero · 898270ec
      Frank Jungclaus authored
      
      [ Upstream commit 918ee491 ]
      
      We don't get any further EVENT from an esd CAN USB device for changes
      on REC or TEC while those counters converge to 0 (with ecc == 0). So
      when handling the "Back to Error Active"-event force txerr = rxerr =
      0, otherwise the berr-counters might stay on values like 95 forever.
      
      Also, to make life easier during the ongoing development a
      netdev_dbg() has been introduced to allow dumping error events send by
      an esd CAN USB device.
      
      Fixes: 96d8e903 ("can: Add driver for esd CAN-USB/2 device")
      Signed-off-by: default avatarFrank Jungclaus <frank.jungclaus@esd.eu>
      Link: https://lore.kernel.org/all/20221130202242.3998219-2-frank.jungclaus@esd.eu
      
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      898270ec
    • Dan Carpenter's avatar
      net: mvneta: Fix an out of bounds check · 08bf219d
      Dan Carpenter authored
      
      [ Upstream commit cdd97383 ]
      
      In an earlier commit, I added a bounds check to prevent an out of bounds
      read and a WARN().  On further discussion and consideration that check
      was probably too aggressive.  Instead of returning -EINVAL, a better fix
      would be to just prevent the out of bounds read but continue the process.
      
      Background: The value of "pp->rxq_def" is a number between 0-7 by default,
      or even higher depending on the value of "rxq_number", which is a module
      parameter. If the value is more than the number of available CPUs then
      it will trigger the WARN() in cpu_max_bits_warn().
      
      Fixes: e8b4fc13 ("net: mvneta: Prevent out of bounds read in mvneta_config_rss()")
      Signed-off-by: default avatarDan Carpenter <error27@gmail.com>
      Reviewed-by: default avatarLeon Romanovsky <leonro@nvidia.com>
      Link: https://lore.kernel.org/r/Y5A7d1E5ccwHTYPf@kadam
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      08bf219d
    • Eric Dumazet's avatar
      ipv6: avoid use-after-free in ip6_fragment() · 6b6d3be3
      Eric Dumazet authored
      
      [ Upstream commit 803e8486 ]
      
      Blamed commit claimed rcu_read_lock() was held by ip6_fragment() callers.
      
      It seems to not be always true, at least for UDP stack.
      
      syzbot reported:
      
      BUG: KASAN: use-after-free in ip6_dst_idev include/net/ip6_fib.h:245 [inline]
      BUG: KASAN: use-after-free in ip6_fragment+0x2724/0x2770 net/ipv6/ip6_output.c:951
      Read of size 8 at addr ffff88801d403e80 by task syz-executor.3/7618
      
      CPU: 1 PID: 7618 Comm: syz-executor.3 Not tainted 6.1.0-rc6-syzkaller-00012-g4312098baf37 #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
      Call Trace:
       <TASK>
       __dump_stack lib/dump_stack.c:88 [inline]
       dump_stack_lvl+0xd1/0x138 lib/dump_stack.c:106
       print_address_description mm/kasan/report.c:284 [inline]
       print_report+0x15e/0x45d mm/kasan/report.c:395
       kasan_report+0xbf/0x1f0 mm/kasan/report.c:495
       ip6_dst_idev include/net/ip6_fib.h:245 [inline]
       ip6_fragment+0x2724/0x2770 net/ipv6/ip6_output.c:951
       __ip6_finish_output net/ipv6/ip6_output.c:193 [inline]
       ip6_finish_output+0x9a3/0x1170 net/ipv6/ip6_output.c:206
       NF_HOOK_COND include/linux/netfilter.h:291 [inline]
       ip6_output+0x1f1/0x540 net/ipv6/ip6_output.c:227
       dst_output include/net/dst.h:445 [inline]
       ip6_local_out+0xb3/0x1a0 net/ipv6/output_core.c:161
       ip6_send_skb+0xbb/0x340 net/ipv6/ip6_output.c:1966
       udp_v6_send_skb+0x82a/0x18a0 net/ipv6/udp.c:1286
       udp_v6_push_pending_frames+0x140/0x200 net/ipv6/udp.c:1313
       udpv6_sendmsg+0x18da/0x2c80 net/ipv6/udp.c:1606
       inet6_sendmsg+0x9d/0xe0 net/ipv6/af_inet6.c:665
       sock_sendmsg_nosec net/socket.c:714 [inline]
       sock_sendmsg+0xd3/0x120 net/socket.c:734
       sock_write_iter+0x295/0x3d0 net/socket.c:1108
       call_write_iter include/linux/fs.h:2191 [inline]
       new_sync_write fs/read_write.c:491 [inline]
       vfs_write+0x9ed/0xdd0 fs/read_write.c:584
       ksys_write+0x1ec/0x250 fs/read_write.c:637
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd
      RIP: 0033:0x7fde3588c0d9
      Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 00 00 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 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
      RSP: 002b:00007fde365b6168 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
      RAX: ffffffffffffffda RBX: 00007fde359ac050 RCX: 00007fde3588c0d9
      RDX: 000000000000ffdc RSI: 00000000200000c0 RDI: 000000000000000a
      RBP: 00007fde358e7ae9 R08: 0000000000000000 R09: 0000000000000000
      R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
      R13: 00007fde35acfb1f R14: 00007fde365b6300 R15: 0000000000022000
       </TASK>
      
      Allocated by task 7618:
       kasan_save_stack+0x22/0x40 mm/kasan/common.c:45
       kasan_set_track+0x25/0x30 mm/kasan/common.c:52
       __kasan_slab_alloc+0x82/0x90 mm/kasan/common.c:325
       kasan_slab_alloc include/linux/kasan.h:201 [inline]
       slab_post_alloc_hook mm/slab.h:737 [inline]
       slab_alloc_node mm/slub.c:3398 [inline]
       slab_alloc mm/slub.c:3406 [inline]
       __kmem_cache_alloc_lru mm/slub.c:3413 [inline]
       kmem_cache_alloc+0x2b4/0x3d0 mm/slub.c:3422
       dst_alloc+0x14a/0x1f0 net/core/dst.c:92
       ip6_dst_alloc+0x32/0xa0 net/ipv6/route.c:344
       ip6_rt_pcpu_alloc net/ipv6/route.c:1369 [inline]
       rt6_make_pcpu_route net/ipv6/route.c:1417 [inline]
       ip6_pol_route+0x901/0x1190 net/ipv6/route.c:2254
       pol_lookup_func include/net/ip6_fib.h:582 [inline]
       fib6_rule_lookup+0x52e/0x6f0 net/ipv6/fib6_rules.c:121
       ip6_route_output_flags_noref+0x2e6/0x380 net/ipv6/route.c:2625
       ip6_route_output_flags+0x76/0x320 net/ipv6/route.c:2638
       ip6_route_output include/net/ip6_route.h:98 [inline]
       ip6_dst_lookup_tail+0x5ab/0x1620 net/ipv6/ip6_output.c:1092
       ip6_dst_lookup_flow+0x90/0x1d0 net/ipv6/ip6_output.c:1222
       ip6_sk_dst_lookup_flow+0x553/0x980 net/ipv6/ip6_output.c:1260
       udpv6_sendmsg+0x151d/0x2c80 net/ipv6/udp.c:1554
       inet6_sendmsg+0x9d/0xe0 net/ipv6/af_inet6.c:665
       sock_sendmsg_nosec net/socket.c:714 [inline]
       sock_sendmsg+0xd3/0x120 net/socket.c:734
       __sys_sendto+0x23a/0x340 net/socket.c:2117
       __do_sys_sendto net/socket.c:2129 [inline]
       __se_sys_sendto net/socket.c:2125 [inline]
       __x64_sys_sendto+0xe1/0x1b0 net/socket.c:2125
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd
      
      Freed by task 7599:
       kasan_save_stack+0x22/0x40 mm/kasan/common.c:45
       kasan_set_track+0x25/0x30 mm/kasan/common.c:52
       kasan_save_free_info+0x2e/0x40 mm/kasan/generic.c:511
       ____kasan_slab_free mm/kasan/common.c:236 [inline]
       ____kasan_slab_free+0x160/0x1c0 mm/kasan/common.c:200
       kasan_slab_free include/linux/kasan.h:177 [inline]
       slab_free_hook mm/slub.c:1724 [inline]
       slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1750
       slab_free mm/slub.c:3661 [inline]
       kmem_cache_free+0xee/0x5c0 mm/slub.c:3683
       dst_destroy+0x2ea/0x400 net/core/dst.c:127
       rcu_do_batch kernel/rcu/tree.c:2250 [inline]
       rcu_core+0x81f/0x1980 kernel/rcu/tree.c:2510
       __do_softirq+0x1fb/0xadc kernel/softirq.c:571
      
      Last potentially related work creation:
       kasan_save_stack+0x22/0x40 mm/kasan/common.c:45
       __kasan_record_aux_stack+0xbc/0xd0 mm/kasan/generic.c:481
       call_rcu+0x9d/0x820 kernel/rcu/tree.c:2798
       dst_release net/core/dst.c:177 [inline]
       dst_release+0x7d/0xe0 net/core/dst.c:167
       refdst_drop include/net/dst.h:256 [inline]
       skb_dst_drop include/net/dst.h:268 [inline]
       skb_release_head_state+0x250/0x2a0 net/core/skbuff.c:838
       skb_release_all net/core/skbuff.c:852 [inline]
       __kfree_skb net/core/skbuff.c:868 [inline]
       kfree_skb_reason+0x151/0x4b0 net/core/skbuff.c:891
       kfree_skb_list_reason+0x4b/0x70 net/core/skbuff.c:901
       kfree_skb_list include/linux/skbuff.h:1227 [inline]
       ip6_fragment+0x2026/0x2770 net/ipv6/ip6_output.c:949
       __ip6_finish_output net/ipv6/ip6_output.c:193 [inline]
       ip6_finish_output+0x9a3/0x1170 net/ipv6/ip6_output.c:206
       NF_HOOK_COND include/linux/netfilter.h:291 [inline]
       ip6_output+0x1f1/0x540 net/ipv6/ip6_output.c:227
       dst_output include/net/dst.h:445 [inline]
       ip6_local_out+0xb3/0x1a0 net/ipv6/output_core.c:161
       ip6_send_skb+0xbb/0x340 net/ipv6/ip6_output.c:1966
       udp_v6_send_skb+0x82a/0x18a0 net/ipv6/udp.c:1286
       udp_v6_push_pending_frames+0x140/0x200 net/ipv6/udp.c:1313
       udpv6_sendmsg+0x18da/0x2c80 net/ipv6/udp.c:1606
       inet6_sendmsg+0x9d/0xe0 net/ipv6/af_inet6.c:665
       sock_sendmsg_nosec net/socket.c:714 [inline]
       sock_sendmsg+0xd3/0x120 net/socket.c:734
       sock_write_iter+0x295/0x3d0 net/socket.c:1108
       call_write_iter include/linux/fs.h:2191 [inline]
       new_sync_write fs/read_write.c:491 [inline]
       vfs_write+0x9ed/0xdd0 fs/read_write.c:584
       ksys_write+0x1ec/0x250 fs/read_write.c:637
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd
      
      Second to last potentially related work creation:
       kasan_save_stack+0x22/0x40 mm/kasan/common.c:45
       __kasan_record_aux_stack+0xbc/0xd0 mm/kasan/generic.c:481
       call_rcu+0x9d/0x820 kernel/rcu/tree.c:2798
       dst_release net/core/dst.c:177 [inline]
       dst_release+0x7d/0xe0 net/core/dst.c:167
       refdst_drop include/net/dst.h:256 [inline]
       skb_dst_drop include/net/dst.h:268 [inline]
       __dev_queue_xmit+0x1b9d/0x3ba0 net/core/dev.c:4211
       dev_queue_xmit include/linux/netdevice.h:3008 [inline]
       neigh_resolve_output net/core/neighbour.c:1552 [inline]
       neigh_resolve_output+0x51b/0x840 net/core/neighbour.c:1532
       neigh_output include/net/neighbour.h:546 [inline]
       ip6_finish_output2+0x56c/0x1530 net/ipv6/ip6_output.c:134
       __ip6_finish_output net/ipv6/ip6_output.c:195 [inline]
       ip6_finish_output+0x694/0x1170 net/ipv6/ip6_output.c:206
       NF_HOOK_COND include/linux/netfilter.h:291 [inline]
       ip6_output+0x1f1/0x540 net/ipv6/ip6_output.c:227
       dst_output include/net/dst.h:445 [inline]
       NF_HOOK include/linux/netfilter.h:302 [inline]
       NF_HOOK include/linux/netfilter.h:296 [inline]
       mld_sendpack+0xa09/0xe70 net/ipv6/mcast.c:1820
       mld_send_cr net/ipv6/mcast.c:2121 [inline]
       mld_ifc_work+0x720/0xdc0 net/ipv6/mcast.c:2653
       process_one_work+0x9bf/0x1710 kernel/workqueue.c:2289
       worker_thread+0x669/0x1090 kernel/workqueue.c:2436
       kthread+0x2e8/0x3a0 kernel/kthread.c:376
       ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306
      
      The buggy address belongs to the object at ffff88801d403dc0
       which belongs to the cache ip6_dst_cache of size 240
      The buggy address is located 192 bytes inside of
       240-byte region [ffff88801d403dc0, ffff88801d403eb0)
      
      The buggy address belongs to the physical page:
      page:ffffea00007500c0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1d403
      memcg:ffff888022f49c81
      flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
      raw: 00fff00000000200 ffffea0001ef6580 dead000000000002 ffff88814addf640
      raw: 0000000000000000 00000000800c000c 00000001ffffffff ffff888022f49c81
      page dumped because: kasan: bad access detected
      page_owner tracks the page as allocated
      page last allocated via order 0, migratetype Unmovable, gfp_mask 0x112a20(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_HARDWALL), pid 3719, tgid 3719 (kworker/0:6), ts 136223432244, free_ts 136222971441
       prep_new_page mm/page_alloc.c:2539 [inline]
       get_page_from_freelist+0x10b5/0x2d50 mm/page_alloc.c:4288
       __alloc_pages+0x1cb/0x5b0 mm/page_alloc.c:5555
       alloc_pages+0x1aa/0x270 mm/mempolicy.c:2285
       alloc_slab_page mm/slub.c:1794 [inline]
       allocate_slab+0x213/0x300 mm/slub.c:1939
       new_slab mm/slub.c:1992 [inline]
       ___slab_alloc+0xa91/0x1400 mm/slub.c:3180
       __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3279
       slab_alloc_node mm/slub.c:3364 [inline]
       slab_alloc mm/slub.c:3406 [inline]
       __kmem_cache_alloc_lru mm/slub.c:3413 [inline]
       kmem_cache_alloc+0x31a/0x3d0 mm/slub.c:3422
       dst_alloc+0x14a/0x1f0 net/core/dst.c:92
       ip6_dst_alloc+0x32/0xa0 net/ipv6/route.c:344
       icmp6_dst_alloc+0x71/0x680 net/ipv6/route.c:3261
       mld_sendpack+0x5de/0xe70 net/ipv6/mcast.c:1809
       mld_send_cr net/ipv6/mcast.c:2121 [inline]
       mld_ifc_work+0x720/0xdc0 net/ipv6/mcast.c:2653
       process_one_work+0x9bf/0x1710 kernel/workqueue.c:2289
       worker_thread+0x669/0x1090 kernel/workqueue.c:2436
       kthread+0x2e8/0x3a0 kernel/kthread.c:376
       ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306
      page last free stack trace:
       reset_page_owner include/linux/page_owner.h:24 [inline]
       free_pages_prepare mm/page_alloc.c:1459 [inline]
       free_pcp_prepare+0x65c/0xd90 mm/page_alloc.c:1509
       free_unref_page_prepare mm/page_alloc.c:3387 [inline]
       free_unref_page+0x1d/0x4d0 mm/page_alloc.c:3483
       __unfreeze_partials+0x17c/0x1a0 mm/slub.c:2586
       qlink_free mm/kasan/quarantine.c:168 [inline]
       qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:187
       kasan_quarantine_reduce+0x184/0x210 mm/kasan/quarantine.c:294
       __kasan_slab_alloc+0x66/0x90 mm/kasan/common.c:302
       kasan_slab_alloc include/linux/kasan.h:201 [inline]
       slab_post_alloc_hook mm/slab.h:737 [inline]
       slab_alloc_node mm/slub.c:3398 [inline]
       kmem_cache_alloc_node+0x304/0x410 mm/slub.c:3443
       __alloc_skb+0x214/0x300 net/core/skbuff.c:497
       alloc_skb include/linux/skbuff.h:1267 [inline]
       netlink_alloc_large_skb net/netlink/af_netlink.c:1191 [inline]
       netlink_sendmsg+0x9a6/0xe10 net/netlink/af_netlink.c:1896
       sock_sendmsg_nosec net/socket.c:714 [inline]
       sock_sendmsg+0xd3/0x120 net/socket.c:734
       __sys_sendto+0x23a/0x340 net/socket.c:2117
       __do_sys_sendto net/socket.c:2129 [inline]
       __se_sys_sendto net/socket.c:2125 [inline]
       __x64_sys_sendto+0xe1/0x1b0 net/socket.c:2125
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd
      
      Fixes: 1758fd46 ("ipv6: remove unnecessary dst_hold() in ip6_fragment()")
      Reported-by: default avatar <syzbot+8c0ac31aa9681abb9e2d@syzkaller.appspotmail.com>
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: Wei Wang <weiwan@google.com>
      Cc: Martin KaFai Lau <kafai@fb.com>
      Link: https://lore.kernel.org/r/20221206101351.2037285-1-edumazet@google.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      6b6d3be3
    • Yang Yingliang's avatar
      net: plip: don't call kfree_skb/dev_kfree_skb() under spin_lock_irq() · f73eb3fc
      Yang Yingliang authored
      
      [ Upstream commit 7d8c19bf ]
      
      It is not allowed to call kfree_skb() or consume_skb() from
      hardware interrupt context or with interrupts being disabled.
      So replace kfree_skb/dev_kfree_skb() with dev_kfree_skb_irq()
      and dev_consume_skb_irq() under spin_lock_irq().
      
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
      Link: https://lore.kernel.org/r/20221207015310.2984909-1-yangyingliang@huawei.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f73eb3fc
    • Juergen Gross's avatar
      xen/netback: fix build warning · f0af234e
      Juergen Gross authored
      
      [ Upstream commit 7dfa764e ]
      
      Commit ad7f402a ("xen/netback: Ensure protocol headers don't fall in
      the non-linear area") introduced a (valid) build warning. There have
      even been reports of this problem breaking networking of Xen guests.
      
      Fixes: ad7f402a ("xen/netback: Ensure protocol headers don't fall in the non-linear area")
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      Reviewed-by: default avatarJan Beulich <jbeulich@suse.com>
      Reviewed-by: default avatarRoss Lagerwall <ross.lagerwall@citrix.com>
      Tested-by: default avatarJason Andryuk <jandryuk@gmail.com>
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f0af234e
    • Zhang Changzhong's avatar
      ethernet: aeroflex: fix potential skb leak in greth_init_rings() · 99669d94
      Zhang Changzhong authored
      
      [ Upstream commit 063a932b ]
      
      The greth_init_rings() function won't free the newly allocated skb when
      dma_mapping_error() returns error, so add dev_kfree_skb() to fix it.
      
      Compile tested only.
      
      Fixes: d4c41139 ("net: Add Aeroflex Gaisler 10/100/1G Ethernet MAC driver")
      Signed-off-by: default avatarZhang Changzhong <zhangchangzhong@huawei.com>
      Reviewed-by: default avatarLeon Romanovsky <leonro@nvidia.com>
      Link: https://lore.kernel.org/r/1670134149-29516-1-git-send-email-zhangchangzhong@huawei.com
      
      
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      99669d94
    • Ido Schimmel's avatar
      ipv4: Fix incorrect route flushing when table ID 0 is used · 3295582c
      Ido Schimmel authored
      
      [ Upstream commit c0d99934 ]
      
      Cited commit added the table ID to the FIB info structure, but did not
      properly initialize it when table ID 0 is used. This can lead to a route
      in the default VRF with a preferred source address not being flushed
      when the address is deleted.
      
      Consider the following example:
      
       # ip address add dev dummy1 192.0.2.1/28
       # ip address add dev dummy1 192.0.2.17/28
       # ip route add 198.51.100.0/24 via 192.0.2.2 src 192.0.2.17 metric 100
       # ip route add table 0 198.51.100.0/24 via 192.0.2.2 src 192.0.2.17 metric 200
       # ip route show 198.51.100.0/24
       198.51.100.0/24 via 192.0.2.2 dev dummy1 src 192.0.2.17 metric 100
       198.51.100.0/24 via 192.0.2.2 dev dummy1 src 192.0.2.17 metric 200
      
      Both routes are installed in the default VRF, but they are using two
      different FIB info structures. One with a metric of 100 and table ID of
      254 (main) and one with a metric of 200 and table ID of 0. Therefore,
      when the preferred source address is deleted from the default VRF,
      the second route is not flushed:
      
       # ip address del dev dummy1 192.0.2.17/28
       # ip route show 198.51.100.0/24
       198.51.100.0/24 via 192.0.2.2 dev dummy1 src 192.0.2.17 metric 200
      
      Fix by storing a table ID of 254 instead of 0 in the route configuration
      structure.
      
      Add a test case that fails before the fix:
      
       # ./fib_tests.sh -t ipv4_del_addr
      
       IPv4 delete address route tests
           Regular FIB info
           TEST: Route removed from VRF when source address deleted            [ OK ]
           TEST: Route in default VRF not removed                              [ OK ]
           TEST: Route removed in default VRF when source address deleted      [ OK ]
           TEST: Route in VRF is not removed by address delete                 [ OK ]
           Identical FIB info with different table ID
           TEST: Route removed from VRF when source address deleted            [ OK ]
           TEST: Route in default VRF not removed                              [ OK ]
           TEST: Route removed in default VRF when source address deleted      [ OK ]
           TEST: Route in VRF is not removed by address delete                 [ OK ]
           Table ID 0
           TEST: Route removed in default VRF when source address deleted      [FAIL]
      
       Tests passed:   8
       Tests failed:   1
      
      And passes after:
      
       # ./fib_tests.sh -t ipv4_del_addr
      
       IPv4 delete address route tests
           Regular FIB info
           TEST: Route removed from VRF when source address deleted            [ OK ]
           TEST: Route in default VRF not removed                              [ OK ]
           TEST: Route removed in default VRF when source address deleted      [ OK ]
           TEST: Route in VRF is not removed by address delete                 [ OK ]
           Identical FIB info with different table ID
           TEST: Route removed from VRF when source address deleted            [ OK ]
           TEST: Route in default VRF not removed                              [ OK ]
           TEST: Route removed in default VRF when source address deleted      [ OK ]
           TEST: Route in VRF is not removed by address delete                 [ OK ]
           Table ID 0
           TEST: Route removed in default VRF when source address deleted      [ OK ]
      
       Tests passed:   9
       Tests failed:   0
      
      Fixes: 5a56a0b3 ("net: Don't delete routes in different VRFs")
      Reported-by: default avatarDonald Sharp <sharpd@nvidia.com>
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3295582c
    • Ido Schimmel's avatar
      ipv4: Fix incorrect route flushing when source address is deleted · 2537b637
      Ido Schimmel authored
      
      [ Upstream commit f96a3d74 ]
      
      Cited commit added the table ID to the FIB info structure, but did not
      prevent structures with different table IDs from being consolidated.
      This can lead to routes being flushed from a VRF when an address is
      deleted from a different VRF.
      
      Fix by taking the table ID into account when looking for a matching FIB
      info. This is already done for FIB info structures backed by a nexthop
      object in fib_find_info_nh().
      
      Add test cases that fail before the fix:
      
       # ./fib_tests.sh -t ipv4_del_addr
      
       IPv4 delete address route tests
           Regular FIB info
           TEST: Route removed from VRF when source address deleted            [ OK ]
           TEST: Route in default VRF not removed                              [ OK ]
           TEST: Route removed in default VRF when source address deleted      [ OK ]
           TEST: Route in VRF is not removed by address delete                 [ OK ]
           Identical FIB info with different table ID
           TEST: Route removed from VRF when source address deleted            [FAIL]
           TEST: Route in default VRF not removed                              [ OK ]
       RTNETLINK answers: File exists
           TEST: Route removed in default VRF when source address deleted      [ OK ]
           TEST: Route in VRF is not removed by address delete                 [FAIL]
      
       Tests passed:   6
       Tests failed:   2
      
      And pass after:
      
       # ./fib_tests.sh -t ipv4_del_addr
      
       IPv4 delete address route tests
           Regular FIB info
           TEST: Route removed from VRF when source address deleted            [ OK ]
           TEST: Route in default VRF not removed                              [ OK ]
           TEST: Route removed in default VRF when source address deleted      [ OK ]
           TEST: Route in VRF is not removed by address delete                 [ OK ]
           Identical FIB info with different table ID
           TEST: Route removed from VRF when source address deleted            [ OK ]
           TEST: Route in default VRF not removed                              [ OK ]
           TEST: Route removed in default VRF when source address deleted      [ OK ]
           TEST: Route in VRF is not removed by address delete                 [ OK ]
      
       Tests passed:   8
       Tests failed:   0
      
      Fixes: 5a56a0b3 ("net: Don't delete routes in different VRFs")
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      2537b637
    • YueHaibing's avatar
      tipc: Fix potential OOB in tipc_link_proto_rcv() · 36eedb9a
      YueHaibing authored
      
      [ Upstream commit 743117a9 ]
      
      Fix the potential risk of OOB if skb_linearize() fails in
      tipc_link_proto_rcv().
      
      Fixes: 5cbb28a4 ("tipc: linearize arriving NAME_DISTR and LINK_PROTO buffers")
      Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
      Link: https://lore.kernel.org/r/20221203094635.29024-1-yuehaibing@huawei.com
      
      
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      36eedb9a
    • Liu Jian's avatar
      net: hisilicon: Fix potential use-after-free in hix5hd2_rx() · 1b6360a0
      Liu Jian authored
      
      [ Upstream commit 433c07a1 ]
      
      The skb is delivered to napi_gro_receive() which may free it, after
      calling this, dereferencing skb may trigger use-after-free.
      
      Fixes: 57c5bc9a ("net: hisilicon: add hix5hd2 mac driver")
      Signed-off-by: default avatarLiu Jian <liujian56@huawei.com>
      Link: https://lore.kernel.org/r/20221203094240.1240211-2-liujian56@huawei.com
      
      
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      1b6360a0
    • Liu Jian's avatar
      net: hisilicon: Fix potential use-after-free in hisi_femac_rx() · e71a46cc
      Liu Jian authored
      
      [ Upstream commit 46401770 ]
      
      The skb is delivered to napi_gro_receive() which may free it, after
      calling this, dereferencing skb may trigger use-after-free.
      
      Fixes: 542ae60a ("net: hisilicon: Add Fast Ethernet MAC driver")
      Signed-off-by: default avatarLiu Jian <liujian56@huawei.com>
      Link: https://lore.kernel.org/r/20221203094240.1240211-1-liujian56@huawei.com
      
      
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e71a46cc
    • Yongqiang Liu's avatar
      net: thunderx: Fix missing destroy_workqueue of nicvf_rx_mode_wq · 7081cf86
      Yongqiang Liu authored
      
      [ Upstream commit 42330a32 ]
      
      The nicvf_probe() won't destroy workqueue when register_netdev()
      failed. Add destroy_workqueue err handle case to fix this issue.
      
      Fixes: 2ecbe4f4 ("net: thunderx: replace global nicvf_rx_mode_wq work queue for all VFs to private for each of them.")
      Signed-off-by: default avatarYongqiang Liu <liuyongqiang13@huawei.com>
      Reviewed-by: default avatarPavan Chebbi <pavan.chebbi@broadcom.com>
      Link: https://lore.kernel.org/r/20221203094125.602812-1-liuyongqiang13@huawei.com
      
      
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      7081cf86
    • Jisheng Zhang's avatar
      net: stmmac: fix "snps,axi-config" node property parsing · bc06207b
      Jisheng Zhang authored
      
      [ Upstream commit 61d4f140 ]
      
      In dt-binding snps,dwmac.yaml, some properties under "snps,axi-config"
      node are named without "axi_" prefix, but the driver expects the
      prefix. Since the dt-binding has been there for a long time, we'd
      better make driver match the binding for compatibility.
      
      Fixes: afea0365 ("stmmac: rework DMA bus setting and introduce new platform AXI structure")
      Signed-off-by: default avatarJisheng Zhang <jszhang@kernel.org>
      Link: https://lore.kernel.org/r/20221202161739.2203-1-jszhang@kernel.org
      
      
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      bc06207b
    • Pankaj Raghav's avatar
      nvme initialize core quirks before calling nvme_init_subsystem · 7fab7add
      Pankaj Raghav authored
      
      [ Upstream commit 6f2d7152 ]
      
      A device might have a core quirk for NVME_QUIRK_IGNORE_DEV_SUBNQN
      (such as Samsung X5) but it would still give a:
      
          "missing or invalid SUBNQN field"
      
      warning as core quirks are filled after calling nvme_init_subnqn.  Fill
      ctrl->quirks from struct core_quirks before calling nvme_init_subsystem
      to fix this.
      
      Tested on a Samsung X5.
      
      Fixes: ab9e00cc ("nvme: track subsystems")
      Signed-off-by: default avatarPankaj Raghav <p.raghav@samsung.com>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      7fab7add
    • Kees Cook's avatar
      NFC: nci: Bounds check struct nfc_target arrays · 67784347
      Kees Cook authored
      
      [ Upstream commit e329e710 ]
      
      While running under CONFIG_FORTIFY_SOURCE=y, syzkaller reported:
      
        memcpy: detected field-spanning write (size 129) of single field "target->sensf_res" at net/nfc/nci/ntf.c:260 (size 18)
      
      This appears to be a legitimate lack of bounds checking in
      nci_add_new_protocol(). Add the missing checks.
      
      Reported-by: default avatar <syzbot+210e196cef4711b65139@syzkaller.appspotmail.com>
      Link: https://lore.kernel.org/lkml/0000000000001c590f05ee7b3ff4@google.com
      
      
      Fixes: 019c4fba ("NFC: Add NCI multiple targets support")
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Reviewed-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
      Link: https://lore.kernel.org/r/20221202214410.never.693-kees@kernel.org
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      67784347
    • Przemyslaw Patynowski's avatar
      i40e: Disallow ip4 and ip6 l4_4_bytes · e5292711
      Przemyslaw Patynowski authored
      
      [ Upstream commit d64aaf3f ]
      
      Return -EOPNOTSUPP, when user requests l4_4_bytes for raw IP4 or
      IP6 flow director filters. Flow director does not support filtering
      on l4 bytes for PCTYPEs used by IP4 and IP6 filters.
      Without this patch, user could create filters with l4_4_bytes fields,
      which did not do any filtering on L4, but only on L3 fields.
      
      Fixes: 36777d9f ("i40e: check current configured input set when adding ntuple filters")
      Signed-off-by: default avatarPrzemyslaw Patynowski <przemyslawx.patynowski@intel.com>
      Signed-off-by: default avatarKamil Maziarz <kamil.maziarz@intel.com>
      Reviewed-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Tested-by: Gurucharan G <gurucharanx.g@intel.com> (A Contingent worker at Intel)
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e5292711
    • Sylwester Dziedziuch's avatar
      i40e: Fix for VF MAC address 0 · 9337d87d
      Sylwester Dziedziuch authored
      
      [ Upstream commit 08501970 ]
      
      After spawning max VFs on a PF, some VFs were not getting resources and
      their MAC addresses were 0. This was caused by PF sleeping before flushing
      HW registers which caused VIRTCHNL_VFR_VFACTIVE to not be set in time for
      VF.
      
      Fix by adding a sleep after hw flush.
      
      Fixes: e4b433f4 ("i40e: reset all VFs in parallel when rebuilding PF")
      Signed-off-by: default avatarSylwester Dziedziuch <sylwesterx.dziedziuch@intel.com>
      Signed-off-by: default avatarJan Sokolowski <jan.sokolowski@intel.com>
      Tested-by: default avatarKonrad Jankowski <konrad0.jankowski@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      9337d87d
    • Michal Jaron's avatar
      i40e: Fix not setting default xps_cpus after reset · a1e29551
      Michal Jaron authored
      
      [ Upstream commit 82e0572b ]
      
      During tx rings configuration default XPS queue config is set and
      __I40E_TX_XPS_INIT_DONE is locked. __I40E_TX_XPS_INIT_DONE state is
      cleared and set again with default mapping only during queues build,
      it means after first setup or reset with queues rebuild. (i.e.
      ethtool -L <interface> combined <number>) After other resets (i.e.
      ethtool -t <interface>) XPS_INIT_DONE is not cleared and those default
      maps cannot be set again. It results in cleared xps_cpus mapping
      until queues are not rebuild or mapping is not set by user.
      
      Add clearing __I40E_TX_XPS_INIT_DONE state during reset to let
      the driver set xps_cpus to defaults again after it was cleared.
      
      Fixes: 6f853d4f ("i40e: allow XPS with QoS enabled")
      Signed-off-by: default avatarMichal Jaron <michalx.jaron@intel.com>
      Signed-off-by: default avatarKamil Maziarz <kamil.maziarz@intel.com>
      Tested-by: Gurucharan <gurucharanx.g@intel.com> (A Contingent worker at Intel)
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a1e29551
    • Dan Carpenter's avatar
      net: mvneta: Prevent out of bounds read in mvneta_config_rss() · eec1fc21
      Dan Carpenter authored
      
      [ Upstream commit e8b4fc13 ]
      
      The pp->indir[0] value comes from the user.  It is passed to:
      
      	if (cpu_online(pp->rxq_def))
      
      inside the mvneta_percpu_elect() function.  It needs bounds checkeding
      to ensure that it is not beyond the end of the cpu bitmap.
      
      Fixes: cad5d847 ("net: mvneta: Fix the CPU choice in mvneta_percpu_elect")
      Signed-off-by: default avatarDan Carpenter <error27@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      eec1fc21
    • Lin Liu's avatar
      xen-netfront: Fix NULL sring after live migration · ed773dd7
      Lin Liu authored
      
      [ Upstream commit d50b7914 ]
      
      A NAPI is setup for each network sring to poll data to kernel
      The sring with source host is destroyed before live migration and
      new sring with target host is setup after live migration.
      The NAPI for the old sring is not deleted until setup new sring
      with target host after migration. With busy_poll/busy_read enabled,
      the NAPI can be polled before got deleted when resume VM.
      
      BUG: unable to handle kernel NULL pointer dereference at
      0000000000000008
      IP: xennet_poll+0xae/0xd20
      PGD 0 P4D 0
      Oops: 0000 [#1] SMP PTI
      Call Trace:
       finish_task_switch+0x71/0x230
       timerqueue_del+0x1d/0x40
       hrtimer_try_to_cancel+0xb5/0x110
       xennet_alloc_rx_buffers+0x2a0/0x2a0
       napi_busy_loop+0xdb/0x270
       sock_poll+0x87/0x90
       do_sys_poll+0x26f/0x580
       tracing_map_insert+0x1d4/0x2f0
       event_hist_trigger+0x14a/0x260
      
       finish_task_switch+0x71/0x230
       __schedule+0x256/0x890
       recalc_sigpending+0x1b/0x50
       xen_sched_clock+0x15/0x20
       __rb_reserve_next+0x12d/0x140
       ring_buffer_lock_reserve+0x123/0x3d0
       event_triggers_call+0x87/0xb0
       trace_event_buffer_commit+0x1c4/0x210
       xen_clocksource_get_cycles+0x15/0x20
       ktime_get_ts64+0x51/0xf0
       SyS_ppoll+0x160/0x1a0
       SyS_ppoll+0x160/0x1a0
       do_syscall_64+0x73/0x130
       entry_SYSCALL_64_after_hwframe+0x41/0xa6
      ...
      RIP: xennet_poll+0xae/0xd20 RSP: ffffb4f041933900
      CR2: 0000000000000008
      ---[ end trace f8601785b354351c ]---
      
      xen frontend should remove the NAPIs for the old srings before live
      migration as the bond srings are destroyed
      
      There is a tiny window between the srings are set to NULL and
      the NAPIs are disabled, It is safe as the NAPI threads are still
      frozen at that time
      
      Signed-off-by: default avatarLin Liu <lin.liu@citrix.com>
      Fixes: 4ec24119 ([NET]: Do not check netif_running() and carrier state in ->poll())
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ed773dd7
    • Valentina Goncharenko's avatar
      net: encx24j600: Fix invalid logic in reading of MISTAT register · 18e10a9e
      Valentina Goncharenko authored
      
      [ Upstream commit 25f427ac ]
      
      A loop for reading MISTAT register continues while regmap_read() fails
      and (mistat & BUSY), but if regmap_read() fails a value of mistat is
      undefined.
      
      The patch proposes to check for BUSY flag only when regmap_read()
      succeed. Compile test only.
      
      Found by Linux Verification Center (linuxtesting.org) with SVACE.
      
      Fixes: d70e5326 ("net: Microchip encx24j600 driver")
      Signed-off-by: default avatarValentina Goncharenko <goncharenko.vp@ispras.ru>
      Reviewed-by: default avatarPavan Chebbi <pavan.chebbi@broadcom.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      18e10a9e
    • Valentina Goncharenko's avatar
      net: encx24j600: Add parentheses to fix precedence · 1356c177
      Valentina Goncharenko authored
      
      [ Upstream commit 167b3f2d ]
      
      In functions regmap_encx24j600_phy_reg_read() and
      regmap_encx24j600_phy_reg_write() in the conditions of the waiting
      cycles for filling the variable 'ret' it is necessary to add parentheses
      to prevent wrong assignment due to logical operations precedence.
      
      Found by Linux Verification Center (linuxtesting.org) with SVACE.
      
      Fixes: d70e5326 ("net: Microchip encx24j600 driver")
      Signed-off-by: default avatarValentina Goncharenko <goncharenko.vp@ispras.ru>
      Reviewed-by: default avatarPavan Chebbi <pavan.chebbi@broadcom.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      1356c177
    • Wei Yongjun's avatar
      mac802154: fix missing INIT_LIST_HEAD in ieee802154_if_add() · 1831d454
      Wei Yongjun authored
      
      [ Upstream commit b3d72d31 ]
      
      Kernel fault injection test reports null-ptr-deref as follows:
      
      BUG: kernel NULL pointer dereference, address: 0000000000000008
      RIP: 0010:cfg802154_netdev_notifier_call+0x120/0x310 include/linux/list.h:114
      Call Trace:
       <TASK>
       raw_notifier_call_chain+0x6d/0xa0 kernel/notifier.c:87
       call_netdevice_notifiers_info+0x6e/0xc0 net/core/dev.c:1944
       unregister_netdevice_many_notify+0x60d/0xcb0 net/core/dev.c:1982
       unregister_netdevice_queue+0x154/0x1a0 net/core/dev.c:10879
       register_netdevice+0x9a8/0xb90 net/core/dev.c:10083
       ieee802154_if_add+0x6ed/0x7e0 net/mac802154/iface.c:659
       ieee802154_register_hw+0x29c/0x330 net/mac802154/main.c:229
       mcr20a_probe+0xaaa/0xcb1 drivers/net/ieee802154/mcr20a.c:1316
      
      ieee802154_if_add() allocates wpan_dev as netdev's private data, but not
      init the list in struct wpan_dev. cfg802154_netdev_notifier_call() manage
      the list when device register/unregister, and may lead to null-ptr-deref.
      
      Use INIT_LIST_HEAD() on it to initialize it correctly.
      
      Fixes: fcf39e6e ("ieee802154: add wpan_dev_list")
      Signed-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
      Acked-by: default avatarAlexander Aring <aahringo@redhat.com>
      
      Link: https://lore.kernel.org/r/20221130091705.1831140-1-weiyongjun@huaweicloud.com
      
      
      Signed-off-by: default avatarStefan Schmidt <stefan@datenfreihafen.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      1831d454
    • Zhengchao Shao's avatar
      selftests: rtnetlink: correct xfrm policy rule in kci_test_ipsec_offload · 8fb4b50f
      Zhengchao Shao authored
      
      [ Upstream commit 85a0506c ]
      
      When testing in kci_test_ipsec_offload, srcip is configured as $dstip,
      it should add xfrm policy rule in instead of out.
      The test result of this patch is as follows:
      PASS: ipsec_offload
      
      Fixes: 2766a111 ("selftests: rtnetlink: add ipsec offload API test")
      Signed-off-by: default avatarZhengchao Shao <shaozhengchao@huawei.com>
      Acked-by: default avatarHangbin Liu <liuhangbin@gmail.com>
      Link: https://lore.kernel.org/r/20221201082246.14131-1-shaozhengchao@huawei.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      8fb4b50f
    • Artem Chernyshev's avatar
      net: dsa: ksz: Check return value · 0834d4b1
      Artem Chernyshev authored
      
      [ Upstream commit 3d8fdcbf ]
      
      Return NULL if we got unexpected value from skb_trim_rcsum()
      in ksz_common_rcv()
      
      Found by Linux Verification Center (linuxtesting.org) with SVACE.
      
      Fixes: bafe9ba7 ("net: dsa: ksz: Factor out common tag code")
      Signed-off-by: default avatarArtem Chernyshev <artem.chernyshev@red-soft.ru>
      Reviewed-by: default avatarVladimir Oltean <olteanv@gmail.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Link: https://lore.kernel.org/r/20221201140032.26746-1-artem.chernyshev@red-soft.ru
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0834d4b1
    • Chen Zhongjin's avatar
      Bluetooth: Fix not cleanup led when bt_init fails · 2c6cf0af
      Chen Zhongjin authored
      
      [ Upstream commit 2f3957c7 ]
      
      bt_init() calls bt_leds_init() to register led, but if it fails later,
      bt_leds_cleanup() is not called to unregister it.
      
      This can cause panic if the argument "bluetooth-power" in text is freed
      and then another led_trigger_register() tries to access it:
      
      BUG: unable to handle page fault for address: ffffffffc06d3bc0
      RIP: 0010:strcmp+0xc/0x30
        Call Trace:
          <TASK>
          led_trigger_register+0x10d/0x4f0
          led_trigger_register_simple+0x7d/0x100
          bt_init+0x39/0xf7 [bluetooth]
          do_one_initcall+0xd0/0x4e0
      
      Fixes: e64c97b5 ("Bluetooth: Add combined LED trigger for controller power")
      Signed-off-by: default avatarChen Zhongjin <chenzhongjin@huawei.com>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      2c6cf0af
    • Wang ShaoBo's avatar
      Bluetooth: 6LoWPAN: add missing hci_dev_put() in get_l2cap_conn() · 07ea5d74
      Wang ShaoBo authored
      
      [ Upstream commit 747da130 ]
      
      hci_get_route() takes reference, we should use hci_dev_put() to release
      it when not need anymore.
      
      Fixes: 6b8d4a6a ("Bluetooth: 6LoWPAN: Use connected oriented channel instead of fixed one")
      Signed-off-by: default avatarWang ShaoBo <bobo.shaobowang@huawei.com>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      07ea5d74
    • Kuniyuki Iwashima's avatar
      af_unix: Get user_ns from in_skb in unix_diag_get_exact(). · c66d78ae
      Kuniyuki Iwashima authored
      [ Upstream commit b3abe42e ]
      
      Wei Chen reported a NULL deref in sk_user_ns() [0][1], and Paolo diagnosed
      the root cause: in unix_diag_get_exact(), the newly allocated skb does not
      have sk. [2]
      
      We must get the user_ns from the NETLINK_CB(in_skb).sk and pass it to
      sk_diag_fill().
      
      [0]:
      BUG: kernel NULL pointer dereference, address: 0000000000000270
      #PF: supervisor read access in kernel mode
      #PF: error_code(0x0000) - not-present page
      PGD 12bbce067 P4D 12bbce067 PUD 12bc40067 PMD 0
      Oops: 0000 [#1] PREEMPT SMP
      CPU: 0 PID: 27942 Comm: syz-executor.0 Not tainted 6.1.0-rc5-next-20221118 #2
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
      rel-1.13.0-48-gd9c812dda519-prebuilt.qemu.org 04/01/2014
      RIP: 0010:sk_user_ns include/net/sock.h:920 [inline]
      RIP: 0010:sk_diag_dump_uid net/unix/diag.c:119 [inline]
      RIP: 0010:sk_diag_fill+0x77d/0x890 net/unix/diag.c:170
      Code: 89 ef e8 66 d4 2d fd c7 44 24 40 00 00 00 00 49 8d 7c 24 18 e8
      54 d7 2d fd 49 8b 5c 24 18 48 8d bb 70 02 00 00 e8 43 d7 2d fd <48> 8b
      9b 70 02 00 00 48 8d 7b 10 e8 33 d7 2d fd 48 8b 5b 10 48 8d
      RSP: 0018:ffffc90000d67968 EFLAGS: 00010246
      RAX: ffff88812badaa48 RBX: 0000000000000000 RCX: ffffffff840d481d
      RDX: 0000000000000465 RSI: 0000000000000000 RDI: 0000000000000270
      RBP: ffffc90000d679a8 R08: 0000000000000277 R09: 0000000000000000
      R10: 0001ffffffffffff R11: 0001c90000d679a8 R12: ffff88812ac03800
      R13: ffff88812c87c400 R14: ffff88812ae42210 R15: ffff888103026940
      FS:  00007f08b4e6f700(0000) GS:ffff88813bc00000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 0000000000000270 CR3: 000000012c58b000 CR4: 00000000003506f0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
       <TASK>
       unix_diag_get_exact net/unix/diag.c:285 [inline]
       unix_diag_handler_dump+0x3f9/0x500 net/unix/diag.c:317
       __sock_diag_cmd net/core/sock_diag.c:235 [inline]
       sock_diag_rcv_msg+0x237/0x250 net/core/sock_diag.c:266
       netlink_rcv_skb+0x13e/0x250 net/netlink/af_netlink.c:2564
       sock_diag_rcv+0x24/0x40 net/core/sock_diag.c:277
       netlink_unicast_kernel net/netlink/af_netlink.c:1330 [inline]
       netlink_unicast+0x5e9/0x6b0 net/netlink/af_netlink.c:1356
       netlink_sendmsg+0x739/0x860 net/netlink/af_netlink.c:1932
       sock_sendmsg_nosec net/socket.c:714 [inline]
       sock_sendmsg net/socket.c:734 [inline]
       ____sys_sendmsg+0x38f/0x500 net/socket.c:2476
       ___sys_sendmsg net/socket.c:2530 [inline]
       __sys_sendmsg+0x197/0x230 net/socket.c:2559
       __do_sys_sendmsg net/socket.c:2568 [inline]
       __se_sys_sendmsg net/socket.c:2566 [inline]
       __x64_sys_sendmsg+0x42/0x50 net/socket.c:2566
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd
      RIP: 0033:0x4697f9
      Code: f7 d8 64 89 02 b8 ff ff ff ff c3 66 0f 1f 44 00 00 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 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48
      RSP: 002b:00007f08b4e6ec48 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
      RAX: ffffffffffffffda RBX: 000000000077bf80 RCX: 00000000004697f9
      RDX: 0000000000000000 RSI: 00000000200001c0 RDI: 0000000000000003
      RBP: 00000000004d29e9 R08: 0000000000000000 R09: 0000000000000000
      R10: 0000000000000000 R11: 0000000000000246 R12: 000000000077bf80
      R13: 0000000000000000 R14: 000000000077bf80 R15: 00007ffdb36bc6c0
       </TASK>
      Modules linked in:
      CR2: 0000000000000270
      
      [1]: https://lore.kernel.org/netdev/CAO4mrfdvyjFpokhNsiwZiP-wpdSD0AStcJwfKcKQdAALQ9_2Qw@mail.gmail.com/
      [2]: https://lore.kernel.org/netdev/e04315e7c90d9a75613f3993c2baf2d344eef7eb.camel@redhat.com/
      
      
      
      Fixes: cae9910e ("net: Add UNIX_DIAG_UID to Netlink UNIX socket diagnostics.")
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Reported-by: default avatarWei Chen <harperchen1110@gmail.com>
      Diagnosed-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c66d78ae
Loading