Skip to content
Permalink
Pablo-Neira-Ay…
Switch branches/tags

Commits on Dec 17, 2021

  1. netfilter: nf_tables: make counter support built-in

    Make counter support built-in to allow for direct call in case of
    CONFIG_RETPOLINE.
    
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    ummakynes authored and intel-lab-lkp committed Dec 17, 2021
  2. netfilter: nf_tables: replace WARN_ON by WARN_ON_ONCE for unknown ver…

    …dicts
    
    Bug might trigger warning for each packet, call WARN_ON_ONCE instead.
    
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    ummakynes authored and intel-lab-lkp committed Dec 17, 2021
  3. netfilter: nf_tables: consolidate rule verdict trace call

    Add function to consolidate verdict tracing.
    
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    ummakynes authored and intel-lab-lkp committed Dec 17, 2021
  4. netfilter: nft_payload: WARN_ON_ONCE instead of BUG

    BUG() is too harsh for unknown payload base, use WARN_ON_ONCE() instead.
    
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    ummakynes authored and intel-lab-lkp committed Dec 17, 2021
  5. netfilter: nf_tables: remove rcu read-size lock

    Chain stats are updated from the Netfilter hook path which already run
    under rcu read-size lock section.
    
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    ummakynes authored and intel-lab-lkp committed Dec 17, 2021

Commits on Dec 16, 2021

  1. netfilter: ctnetlink: remove expired entries first

    When dumping conntrack table to userspace via ctnetlink, check if the ct has
    already expired before doing any of the 'skip' checks.
    
    This expires dead entries faster.
    /proc handler also removes outdated entries first.
    
    Reported-by: Vitaly Zuevsky <vzuevsky@ns1.com>
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Florian Westphal authored and ummakynes committed Dec 16, 2021

Commits on Dec 15, 2021

  1. netfilter: fix regression in looped (broad|multi)cast's MAC handling

    In commit 5648b5e ("netfilter: nfnetlink_queue: fix OOB when mac
    header was cleared"), the test for non-empty MAC header introduced in
    commit 2c38de4 ("netfilter: fix looped (broad|multi)cast's MAC
    handling") has been replaced with a test for a set MAC header.
    
    This breaks the case when the MAC header has been reset (using
    skb_reset_mac_header), as is the case with looped-back multicast
    packets.  As a result, the packets ending up in NFQUEUE get a bogus
    hwaddr interpreted from the first bytes of the IP header.
    
    This patch adds a test for a non-empty MAC header in addition to the
    test for a set MAC header.  The same two tests are also implemented in
    nfnetlink_log.c, where the initial code of commit 2c38de4
    ("netfilter: fix looped (broad|multi)cast's MAC handling") has not been
    touched, but where supposedly the same situation may happen.
    
    Fixes: 5648b5e ("netfilter: nfnetlink_queue: fix OOB when mac header was cleared")
    Signed-off-by: Ignacy Gawędzki <ignacy.gawedzki@green-communications.fr>
    Reviewed-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    iazz authored and ummakynes committed Dec 15, 2021
  2. netfilter: nf_tables: fix use-after-free in nft_set_catchall_destroy()

    We need to use list_for_each_entry_safe() iterator
    because we can not access @catchall after kfree_rcu() call.
    
    syzbot reported:
    
    BUG: KASAN: use-after-free in nft_set_catchall_destroy net/netfilter/nf_tables_api.c:4486 [inline]
    BUG: KASAN: use-after-free in nft_set_destroy net/netfilter/nf_tables_api.c:4504 [inline]
    BUG: KASAN: use-after-free in nft_set_destroy+0x3fd/0x4f0 net/netfilter/nf_tables_api.c:4493
    Read of size 8 at addr ffff8880716e5b80 by task syz-executor.3/8871
    
    CPU: 1 PID: 8871 Comm: syz-executor.3 Not tainted 5.16.0-rc5-syzkaller #0
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
    Call Trace:
     <TASK>
     __dump_stack lib/dump_stack.c:88 [inline]
     dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
     print_address_description.constprop.0.cold+0x8d/0x2ed mm/kasan/report.c:247
     __kasan_report mm/kasan/report.c:433 [inline]
     kasan_report.cold+0x83/0xdf mm/kasan/report.c:450
     nft_set_catchall_destroy net/netfilter/nf_tables_api.c:4486 [inline]
     nft_set_destroy net/netfilter/nf_tables_api.c:4504 [inline]
     nft_set_destroy+0x3fd/0x4f0 net/netfilter/nf_tables_api.c:4493
     __nft_release_table+0x79f/0xcd0 net/netfilter/nf_tables_api.c:9626
     nft_rcv_nl_event+0x4f8/0x670 net/netfilter/nf_tables_api.c:9688
     notifier_call_chain+0xb5/0x200 kernel/notifier.c:83
     blocking_notifier_call_chain kernel/notifier.c:318 [inline]
     blocking_notifier_call_chain+0x67/0x90 kernel/notifier.c:306
     netlink_release+0xcb6/0x1dd0 net/netlink/af_netlink.c:788
     __sock_release+0xcd/0x280 net/socket.c:649
     sock_close+0x18/0x20 net/socket.c:1314
     __fput+0x286/0x9f0 fs/file_table.c:280
     task_work_run+0xdd/0x1a0 kernel/task_work.c:164
     tracehook_notify_resume include/linux/tracehook.h:189 [inline]
     exit_to_user_mode_loop kernel/entry/common.c:175 [inline]
     exit_to_user_mode_prepare+0x27e/0x290 kernel/entry/common.c:207
     __syscall_exit_to_user_mode_work kernel/entry/common.c:289 [inline]
     syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:300
     do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86
     entry_SYSCALL_64_after_hwframe+0x44/0xae
    RIP: 0033:0x7f75fbf28adb
    Code: 0f 05 48 3d 00 f0 ff ff 77 45 c3 0f 1f 40 00 48 83 ec 18 89 7c 24 0c e8 63 fc ff ff 8b 7c 24 0c 41 89 c0 b8 03 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 35 44 89 c7 89 44 24 0c e8 a1 fc ff ff 8b 44
    RSP: 002b:00007ffd8da7ec10 EFLAGS: 00000293 ORIG_RAX: 0000000000000003
    RAX: 0000000000000000 RBX: 0000000000000004 RCX: 00007f75fbf28adb
    RDX: 00007f75fc08e828 RSI: ffffffffffffffff RDI: 0000000000000003
    RBP: 00007f75fc08a960 R08: 0000000000000000 R09: 00007f75fc08e830
    R10: 00007ffd8da7ed10 R11: 0000000000000293 R12: 00000000002067c3
    R13: 00007ffd8da7ed10 R14: 00007f75fc088f60 R15: 0000000000000032
     </TASK>
    
    Allocated by task 8886:
     kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38
     kasan_set_track mm/kasan/common.c:46 [inline]
     set_alloc_info mm/kasan/common.c:434 [inline]
     ____kasan_kmalloc mm/kasan/common.c:513 [inline]
     ____kasan_kmalloc mm/kasan/common.c:472 [inline]
     __kasan_kmalloc+0xa6/0xd0 mm/kasan/common.c:522
     kasan_kmalloc include/linux/kasan.h:269 [inline]
     kmem_cache_alloc_trace+0x1ea/0x4a0 mm/slab.c:3575
     kmalloc include/linux/slab.h:590 [inline]
     nft_setelem_catchall_insert net/netfilter/nf_tables_api.c:5544 [inline]
     nft_setelem_insert net/netfilter/nf_tables_api.c:5562 [inline]
     nft_add_set_elem+0x232e/0x2f40 net/netfilter/nf_tables_api.c:5936
     nf_tables_newsetelem+0x6ff/0xbb0 net/netfilter/nf_tables_api.c:6032
     nfnetlink_rcv_batch+0x1710/0x25f0 net/netfilter/nfnetlink.c:513
     nfnetlink_rcv_skb_batch net/netfilter/nfnetlink.c:634 [inline]
     nfnetlink_rcv+0x3af/0x420 net/netfilter/nfnetlink.c:652
     netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline]
     netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1345
     netlink_sendmsg+0x904/0xdf0 net/netlink/af_netlink.c:1921
     sock_sendmsg_nosec net/socket.c:704 [inline]
     sock_sendmsg+0xcf/0x120 net/socket.c:724
     ____sys_sendmsg+0x6e8/0x810 net/socket.c:2409
     ___sys_sendmsg+0xf3/0x170 net/socket.c:2463
     __sys_sendmsg+0xe5/0x1b0 net/socket.c:2492
     do_syscall_x64 arch/x86/entry/common.c:50 [inline]
     do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
     entry_SYSCALL_64_after_hwframe+0x44/0xae
    
    Freed by task 15335:
     kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38
     kasan_set_track+0x21/0x30 mm/kasan/common.c:46
     kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:370
     ____kasan_slab_free mm/kasan/common.c:366 [inline]
     ____kasan_slab_free mm/kasan/common.c:328 [inline]
     __kasan_slab_free+0xd1/0x110 mm/kasan/common.c:374
     kasan_slab_free include/linux/kasan.h:235 [inline]
     __cache_free mm/slab.c:3445 [inline]
     kmem_cache_free_bulk+0x67/0x1e0 mm/slab.c:3766
     kfree_bulk include/linux/slab.h:446 [inline]
     kfree_rcu_work+0x51c/0xa10 kernel/rcu/tree.c:3273
     process_one_work+0x9b2/0x1690 kernel/workqueue.c:2298
     worker_thread+0x658/0x11f0 kernel/workqueue.c:2445
     kthread+0x405/0x4f0 kernel/kthread.c:327
     ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295
    
    Last potentially related work creation:
     kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38
     __kasan_record_aux_stack+0xb5/0xe0 mm/kasan/generic.c:348
     kvfree_call_rcu+0x74/0x990 kernel/rcu/tree.c:3550
     nft_set_catchall_destroy net/netfilter/nf_tables_api.c:4489 [inline]
     nft_set_destroy net/netfilter/nf_tables_api.c:4504 [inline]
     nft_set_destroy+0x34a/0x4f0 net/netfilter/nf_tables_api.c:4493
     __nft_release_table+0x79f/0xcd0 net/netfilter/nf_tables_api.c:9626
     nft_rcv_nl_event+0x4f8/0x670 net/netfilter/nf_tables_api.c:9688
     notifier_call_chain+0xb5/0x200 kernel/notifier.c:83
     blocking_notifier_call_chain kernel/notifier.c:318 [inline]
     blocking_notifier_call_chain+0x67/0x90 kernel/notifier.c:306
     netlink_release+0xcb6/0x1dd0 net/netlink/af_netlink.c:788
     __sock_release+0xcd/0x280 net/socket.c:649
     sock_close+0x18/0x20 net/socket.c:1314
     __fput+0x286/0x9f0 fs/file_table.c:280
     task_work_run+0xdd/0x1a0 kernel/task_work.c:164
     tracehook_notify_resume include/linux/tracehook.h:189 [inline]
     exit_to_user_mode_loop kernel/entry/common.c:175 [inline]
     exit_to_user_mode_prepare+0x27e/0x290 kernel/entry/common.c:207
     __syscall_exit_to_user_mode_work kernel/entry/common.c:289 [inline]
     syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:300
     do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86
     entry_SYSCALL_64_after_hwframe+0x44/0xae
    
    The buggy address belongs to the object at ffff8880716e5b80
     which belongs to the cache kmalloc-64 of size 64
    The buggy address is located 0 bytes inside of
     64-byte region [ffff8880716e5b80, ffff8880716e5bc0)
    The buggy address belongs to the page:
    page:ffffea0001c5b940 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff8880716e5c00 pfn:0x716e5
    flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
    raw: 00fff00000000200 ffffea0000911848 ffffea00007c4d48 ffff888010c40200
    raw: ffff8880716e5c00 ffff8880716e5000 000000010000001e 0000000000000000
    page dumped because: kasan: bad access detected
    page_owner tracks the page as allocated
    page last allocated via order 0, migratetype Unmovable, gfp_mask 0x242040(__GFP_IO|__GFP_NOWARN|__GFP_COMP|__GFP_THISNODE), pid 3638, ts 211086074437, free_ts 211031029429
     prep_new_page mm/page_alloc.c:2418 [inline]
     get_page_from_freelist+0xa72/0x2f50 mm/page_alloc.c:4149
     __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5369
     __alloc_pages_node include/linux/gfp.h:570 [inline]
     kmem_getpages mm/slab.c:1377 [inline]
     cache_grow_begin+0x75/0x470 mm/slab.c:2593
     cache_alloc_refill+0x27f/0x380 mm/slab.c:2965
     ____cache_alloc mm/slab.c:3048 [inline]
     ____cache_alloc mm/slab.c:3031 [inline]
     __do_cache_alloc mm/slab.c:3275 [inline]
     slab_alloc mm/slab.c:3316 [inline]
     __do_kmalloc mm/slab.c:3700 [inline]
     __kmalloc+0x3b3/0x4d0 mm/slab.c:3711
     kmalloc include/linux/slab.h:595 [inline]
     kzalloc include/linux/slab.h:724 [inline]
     tomoyo_get_name+0x234/0x480 security/tomoyo/memory.c:173
     tomoyo_parse_name_union+0xbc/0x160 security/tomoyo/util.c:260
     tomoyo_update_path_number_acl security/tomoyo/file.c:687 [inline]
     tomoyo_write_file+0x629/0x7f0 security/tomoyo/file.c:1034
     tomoyo_write_domain2+0x116/0x1d0 security/tomoyo/common.c:1152
     tomoyo_add_entry security/tomoyo/common.c:2042 [inline]
     tomoyo_supervisor+0xbc7/0xf00 security/tomoyo/common.c:2103
     tomoyo_audit_path_number_log security/tomoyo/file.c:235 [inline]
     tomoyo_path_number_perm+0x419/0x590 security/tomoyo/file.c:734
     security_file_ioctl+0x50/0xb0 security/security.c:1541
     __do_sys_ioctl fs/ioctl.c:868 [inline]
     __se_sys_ioctl fs/ioctl.c:860 [inline]
     __x64_sys_ioctl+0xb3/0x200 fs/ioctl.c:860
     do_syscall_x64 arch/x86/entry/common.c:50 [inline]
     do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
     entry_SYSCALL_64_after_hwframe+0x44/0xae
    page last free stack trace:
     reset_page_owner include/linux/page_owner.h:24 [inline]
     free_pages_prepare mm/page_alloc.c:1338 [inline]
     free_pcp_prepare+0x374/0x870 mm/page_alloc.c:1389
     free_unref_page_prepare mm/page_alloc.c:3309 [inline]
     free_unref_page+0x19/0x690 mm/page_alloc.c:3388
     slab_destroy mm/slab.c:1627 [inline]
     slabs_destroy+0x89/0xc0 mm/slab.c:1647
     cache_flusharray mm/slab.c:3418 [inline]
     ___cache_free+0x4cc/0x610 mm/slab.c:3480
     qlink_free mm/kasan/quarantine.c:146 [inline]
     qlist_free_all+0x4e/0x110 mm/kasan/quarantine.c:165
     kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:272
     __kasan_slab_alloc+0x97/0xb0 mm/kasan/common.c:444
     kasan_slab_alloc include/linux/kasan.h:259 [inline]
     slab_post_alloc_hook mm/slab.h:519 [inline]
     slab_alloc_node mm/slab.c:3261 [inline]
     kmem_cache_alloc_node+0x2ea/0x590 mm/slab.c:3599
     __alloc_skb+0x215/0x340 net/core/skbuff.c:414
     alloc_skb include/linux/skbuff.h:1126 [inline]
     nlmsg_new include/net/netlink.h:953 [inline]
     rtmsg_ifinfo_build_skb+0x72/0x1a0 net/core/rtnetlink.c:3808
     rtmsg_ifinfo_event net/core/rtnetlink.c:3844 [inline]
     rtmsg_ifinfo_event net/core/rtnetlink.c:3835 [inline]
     rtmsg_ifinfo+0x83/0x120 net/core/rtnetlink.c:3853
     netdev_state_change net/core/dev.c:1395 [inline]
     netdev_state_change+0x114/0x130 net/core/dev.c:1386
     linkwatch_do_dev+0x10e/0x150 net/core/link_watch.c:167
     __linkwatch_run_queue+0x233/0x6a0 net/core/link_watch.c:213
     linkwatch_event+0x4a/0x60 net/core/link_watch.c:252
     process_one_work+0x9b2/0x1690 kernel/workqueue.c:2298
    
    Memory state around the buggy address:
     ffff8880716e5a80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
     ffff8880716e5b00: 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc
    >ffff8880716e5b80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
                       ^
     ffff8880716e5c00: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
     ffff8880716e5c80: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
    
    Fixes: aaa3104 ("netfilter: nftables: add catch-all set element support")
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Reported-by: syzbot <syzkaller@googlegroups.com>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    neebe000 authored and ummakynes committed Dec 15, 2021
  3. Merge tag 'wireless-drivers-2021-12-15' of git://git.kernel.org/pub/s…

    …cm/linux/kernel/git/kvalo/wireless-drivers
    
    Kalle Valo says:
    
    ====================
    wireless-drivers fixes for v5.16
    
    Second set of fixes for v5.16, hopefully also the last one. I changed
    my email in MAINTAINERS, one crash fix in iwlwifi and some build
    problems fixed.
    
    iwlwifi
    
    * fix crash caused by a warning
    
    * fix LED linking problem
    
    brcmsmac
    
    * rework LED dependencies for being consistent with other drivers
    
    mt76
    
    * mt7921: fix build regression
    ====================
    
    Signed-off-by: David S. Miller <davem@davemloft.net>
    davem330 committed Dec 15, 2021
  4. Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/gi…

    …t/tnguy/net-queue
    
    Tony Nguyen says:
    
    ====================
    Intel Wired LAN Driver Updates 2021-12-14
    
    This series contains updates to ice driver only.
    
    Karol corrects division that was causing incorrect calculations and
    adds a check to ensure stale timestamps are not being used.
    ====================
    
    Signed-off-by: David S. Miller <davem@davemloft.net>
    davem330 committed Dec 15, 2021
  5. Merge branch 'mptcp-fixes-for-ulp-a-deadlock-and-netlink-docs'

    Mat Martineau says:
    
    ====================
    mptcp: Fixes for ULP, a deadlock, and netlink docs
    
    Two of the MPTCP fixes in this set are related to the TCP_ULP socket
    option with MPTCP sockets operating in "fallback" mode (the connection
    has reverted to regular TCP). The other issues are an observed deadlock
    and missing parameter documentation in the MPTCP netlink API.
    
    Patch 1 marks TCP_ULP as unsupported earlier in MPTCP setsockopt code,
    so the fallback code path in the MPTCP layer does not pass the TCP_ULP
    option down to the subflow TCP socket.
    
    Patch 2 makes sure a TCP fallback socket returned to userspace by
    accept()ing on a MPTCP listening socket does not allow use of the
    "mptcp" TCP_ULP type. That ULP is intended only for use by in-kernel
    MPTCP subflows.
    
    Patch 3 fixes the possible deadlock when sending data and there are
    socket option changes to sync to the subflows.
    
    Patch 4 makes sure all MPTCP netlink event parameters are documented
    in the MPTCP uapi header.
    ====================
    
    Link: https://lore.kernel.org/r/20211214231604.211016-1-mathew.j.martineau@linux.intel.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Jakub Kicinski committed Dec 15, 2021
  6. mptcp: add missing documented NL params

    'loc_id' and 'rem_id' are set in all events linked to subflows but those
    were missing in the events description in the comments.
    
    Fixes: b911c97 ("mptcp: add netlink event support")
    Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
    Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    matttbe authored and Jakub Kicinski committed Dec 15, 2021
  7. mptcp: fix deadlock in __mptcp_push_pending()

    __mptcp_push_pending() may call mptcp_flush_join_list() with subflow
    socket lock held. If such call hits mptcp_sockopt_sync_all() then
    subsequently __mptcp_sockopt_sync() could try to lock the subflow
    socket for itself, causing a deadlock.
    
    sysrq: Show Blocked State
    task:ss-server       state:D stack:    0 pid:  938 ppid:     1 flags:0x00000000
    Call Trace:
     <TASK>
     __schedule+0x2d6/0x10c0
     ? __mod_memcg_state+0x4d/0x70
     ? csum_partial+0xd/0x20
     ? _raw_spin_lock_irqsave+0x26/0x50
     schedule+0x4e/0xc0
     __lock_sock+0x69/0x90
     ? do_wait_intr_irq+0xa0/0xa0
     __lock_sock_fast+0x35/0x50
     mptcp_sockopt_sync_all+0x38/0xc0
     __mptcp_push_pending+0x105/0x200
     mptcp_sendmsg+0x466/0x490
     sock_sendmsg+0x57/0x60
     __sys_sendto+0xf0/0x160
     ? do_wait_intr_irq+0xa0/0xa0
     ? fpregs_restore_userregs+0x12/0xd0
     __x64_sys_sendto+0x20/0x30
     do_syscall_64+0x38/0x90
     entry_SYSCALL_64_after_hwframe+0x44/0xae
    RIP: 0033:0x7f9ba546c2d0
    RSP: 002b:00007ffdc3b762d8 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
    RAX: ffffffffffffffda RBX: 00007f9ba56c8060 RCX: 00007f9ba546c2d0
    RDX: 000000000000077a RSI: 0000000000e5e180 RDI: 0000000000000234
    RBP: 0000000000cc57f0 R08: 0000000000000000 R09: 0000000000000000
    R10: 0000000000000000 R11: 0000000000000246 R12: 00007f9ba56c8060
    R13: 0000000000b6ba60 R14: 0000000000cc7840 R15: 41d8685b1d7901b8
     </TASK>
    
    Fix the issue by using __mptcp_flush_join_list() instead of plain
    mptcp_flush_join_list() inside __mptcp_push_pending(), as suggested by
    Florian. The sockopt sync will be deferred to the workqueue.
    
    Fixes: 1b3e7ed ("mptcp: setsockopt: handle SO_KEEPALIVE and SO_PRIORITY")
    Closes: multipath-tcp/mptcp_net-next#244
    Suggested-by: Florian Westphal <fw@strlen.de>
    Reviewed-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Maxim Galaganov <max@internet.ru>
    Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    darkwrat authored and Jakub Kicinski committed Dec 15, 2021
  8. mptcp: clear 'kern' flag from fallback sockets

    The mptcp ULP extension relies on sk->sk_sock_kern being set correctly:
    It prevents setsockopt(fd, IPPROTO_TCP, TCP_ULP, "mptcp", 6); from
    working for plain tcp sockets (any userspace-exposed socket).
    
    But in case of fallback, accept() can return a plain tcp sk.
    In such case, sk is still tagged as 'kernel' and setsockopt will work.
    
    This will crash the kernel, The subflow extension has a NULL ctx->conn
    mptcp socket:
    
    BUG: KASAN: null-ptr-deref in subflow_data_ready+0x181/0x2b0
    Call Trace:
     tcp_data_ready+0xf8/0x370
     [..]
    
    Fixes: cf7da0d ("mptcp: Create SUBFLOW socket for incoming connections")
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Florian Westphal authored and Jakub Kicinski committed Dec 15, 2021
  9. mptcp: remove tcp ulp setsockopt support

    TCP_ULP setsockopt cannot be used for mptcp because its already
    used internally to plumb subflow (tcp) sockets to the mptcp layer.
    
    syzbot managed to trigger a crash for mptcp connections that are
    in fallback mode:
    
    KASAN: null-ptr-deref in range [0x0000000000000020-0x0000000000000027]
    CPU: 1 PID: 1083 Comm: syz-executor.3 Not tainted 5.16.0-rc2-syzkaller #0
    RIP: 0010:tls_build_proto net/tls/tls_main.c:776 [inline]
    [..]
     __tcp_set_ulp net/ipv4/tcp_ulp.c:139 [inline]
     tcp_set_ulp+0x428/0x4c0 net/ipv4/tcp_ulp.c:160
     do_tcp_setsockopt+0x455/0x37c0 net/ipv4/tcp.c:3391
     mptcp_setsockopt+0x1b47/0x2400 net/mptcp/sockopt.c:638
    
    Remove support for TCP_ULP setsockopt.
    
    Fixes: d9e4c12 ("mptcp: only admit explicitly supported sockopt")
    Reported-by: syzbot+1fd9b69cde42967d1add@syzkaller.appspotmail.com
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Florian Westphal authored and Jakub Kicinski committed Dec 15, 2021

Commits on Dec 14, 2021

  1. ice: Don't put stale timestamps in the skb

    The driver has to check if it does not accidentally put the timestamp in
    the SKB before previous timestamp gets overwritten.
    Timestamp values in the PHY are read only and do not get cleared except
    at hardware reset or when a new timestamp value is captured.
    The cached_tstamp field is used to detect the case where a new timestamp
    has not yet been captured, ensuring that we avoid sending stale
    timestamp data to the stack.
    
    Fixes: ea9b847 ("ice: enable transmit timestamps for E810 devices")
    Signed-off-by: Karol Kolacinski <karol.kolacinski@intel.com>
    Tested-by: Gurucharan G <gurucharanx.g@intel.com>
    Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
    kolacinskikarol authored and anguy11 committed Dec 14, 2021
  2. ice: Use div64_u64 instead of div_u64 in adjfine

    Change the division in ice_ptp_adjfine from div_u64 to div64_u64.
    div_u64 is used when the divisor is 32 bit but in this case incval is
    64 bit and it caused incorrect calculations and incval adjustments.
    
    Fixes: 06c16d8 ("ice: register 1588 PTP clock device object for E810 devices")
    Signed-off-by: Karol Kolacinski <karol.kolacinski@intel.com>
    Tested-by: Gurucharan G <gurucharanx.g@intel.com>
    Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
    kolacinskikarol authored and anguy11 committed Dec 14, 2021
  3. Merge branch 'mlxsw-fixes'

    Ido Schimmel says:
    
    ====================
    mlxsw: MAC profiles occupancy fix
    
    Patch #1 fixes a router interface (RIF) MAC profiles occupancy bug that
    was merged in the last cycle.
    
    Patch #2 adds a selftest that fails without the fix.
    ====================
    
    Signed-off-by: David S. Miller <davem@davemloft.net>
    davem330 committed Dec 14, 2021
  4. selftests: mlxsw: Add a test case for MAC profiles consolidation

    Add a test case to cover the bug fixed by the previous patch.
    
    Edit the MAC address of one netdev so that it matches the MAC address of
    the second netdev. Verify that the two MAC profiles were consolidated by
    testing that the MAC profiles occupancy decreased by one.
    
    Signed-off-by: Danielle Ratson <danieller@nvidia.com>
    Signed-off-by: Ido Schimmel <idosch@nvidia.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Danielle Ratson authored and davem330 committed Dec 14, 2021
  5. mlxsw: spectrum_router: Consolidate MAC profiles when possible

    Currently, when setting a router interface (RIF) MAC address while the
    MAC profile is not shared with other RIFs, the profile is edited so that
    the new MAC address is assigned to it.
    
    This does not take into account a situation in which the new MAC address
    already matches an existing MAC profile. In that situation, two MAC
    profiles will be occupied even though they hold MAC addresses from the
    same profile.
    
    In order to prevent that, add a check to ensure that editing a MAC
    profile takes place only when the new MAC address does not match an
    existing profile.
    
    Fixes: 605d25c ("mlxsw: spectrum_router: Add RIF MAC profiles support")
    Reported-by: Maksym Yaremchuk <maksymy@nvidia.com>
    Tested-by: Maksym Yaremchuk <maksymy@nvidia.com>
    Signed-off-by: Danielle Ratson <danieller@nvidia.com>
    Signed-off-by: Ido Schimmel <idosch@nvidia.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Danielle Ratson authored and davem330 committed Dec 14, 2021
  6. rds: memory leak in __rds_conn_create()

    __rds_conn_create() did not release conn->c_path when loop_trans != 0 and
    trans->t_prefer_loopback != 0 and is_outgoing == 0.
    
    Fixes: aced3ce ("RDS tcp loopback connection can hang")
    Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
    Reviewed-by: Sharath Srinivasan <sharath.srinivasan@oracle.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    HBh25Y authored and davem330 committed Dec 14, 2021
  7. Merge tag 'mac80211-for-net-2021-12-14' of git://git.kernel.org/pub/s…

    …cm/linux/kernel/git/jberg/mac80211
    
    Johannes Berg says:
    
    ====================
    A fairly large number of fixes this time:
     * fix a station info memory leak on insert collisions
     * a rate control fix for retransmissions
     * two aggregation setup fixes
     * reload current regdomain when reloading database
     * a locking fix in regulatory work
     * a probe request allocation size fix in mac80211
     * apply TCP vs. aggregation (sk pacing) on mesh
     * fix ordering of channel context update vs. station
       state
     * set up skb->dev for mesh forwarding properly
     * track QoS data frames only for admission control to
       avoid out-of-bounds read (found by syzbot)
     * validate extended element ID vs. existing data to
       avoid out-of-bounds read (found by syzbot)
     * fix locking in mac80211 aggregation TX setup
     * fix traffic stall after HW restart when TXQs are used
     * fix ordering of reconfig/restart after HW restart
     * fix interface type for extended aggregation capability
       lookup
    ====================
    
    Signed-off-by: David S. Miller <davem@davemloft.net>
    davem330 committed Dec 14, 2021
  8. Merge branch '40GbE' of git://git.kernel.org/pub/scm/linux/kernel/git…

    …/tnguy/net-queue
    
    Tony Nguyen says:
    
    ====================
    Intel Wired LAN Driver Updates 2021-12-13
    
    This series contains updates to iavf driver only.
    
    Dan Carpenter fixes some missing mutex unlocking.
    
    Stefan Assmann restores stopping watchdog from overriding to reset state.
    ====================
    
    Signed-off-by: David S. Miller <davem@davemloft.net>
    davem330 committed Dec 14, 2021
  9. flow_offload: return EOPNOTSUPP for the unsupported mpls action type

    We need to return EOPNOTSUPP for the unsupported mpls action type when
    setup the flow action.
    
    In the original implement, we will return 0 for the unsupported mpls
    action type, actually we do not setup it and the following actions
    to the flow action entry.
    
    Fixes: 9838b20 ("net: sched: take rtnl lock in tc_setup_flow_action()")
    Signed-off-by: Baowen Zheng <baowen.zheng@corigine.com>
    Signed-off-by: Simon Horman <simon.horman@corigine.com>
    Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    zhengbaowen authored and davem330 committed Dec 14, 2021
  10. net: stmmac: fix tc flower deletion for VLAN priority Rx steering

    To replicate the issue:-
    
    1) Add 1 flower filter for VLAN Priority based frame steering:-
    $ IFDEVNAME=eth0
    $ tc qdisc add dev $IFDEVNAME ingress
    $ tc qdisc add dev $IFDEVNAME root mqprio num_tc 8 \
       map 0 1 2 3 4 5 6 7 0 0 0 0 0 0 0 0 \
       queues 1@0 1@1 1@2 1@3 1@4 1@5 1@6 1@7 hw 0
    $ tc filter add dev $IFDEVNAME parent ffff: protocol 802.1Q \
       flower vlan_prio 0 hw_tc 0
    
    2) Get the 'pref' id
    $ tc filter show dev $IFDEVNAME ingress
    
    3) Delete a specific tc flower record (say pref 49151)
    $ tc filter del dev $IFDEVNAME parent ffff: pref 49151
    
    From dmesg, we will observe kernel NULL pointer ooops
    
    [  197.170464] BUG: kernel NULL pointer dereference, address: 0000000000000000
    [  197.171367] #PF: supervisor read access in kernel mode
    [  197.171367] #PF: error_code(0x0000) - not-present page
    [  197.171367] PGD 0 P4D 0
    [  197.171367] Oops: 0000 [#1] PREEMPT SMP NOPTI
    
    <snip>
    
    [  197.171367] RIP: 0010:tc_setup_cls+0x20b/0x4a0 [stmmac]
    
    <snip>
    
    [  197.171367] Call Trace:
    [  197.171367]  <TASK>
    [  197.171367]  ? __stmmac_disable_all_queues+0xa8/0xe0 [stmmac]
    [  197.171367]  stmmac_setup_tc_block_cb+0x70/0x110 [stmmac]
    [  197.171367]  tc_setup_cb_destroy+0xb3/0x180
    [  197.171367]  fl_hw_destroy_filter+0x94/0xc0 [cls_flower]
    
    The above issue is due to previous incorrect implementation of
    tc_del_vlan_flow(), shown below, that uses flow_cls_offload_flow_rule()
    to get struct flow_rule *rule which is no longer valid for tc filter
    delete operation.
    
      struct flow_rule *rule = flow_cls_offload_flow_rule(cls);
      struct flow_dissector *dissector = rule->match.dissector;
    
    So, to ensure tc_del_vlan_flow() deletes the right VLAN cls record for
    earlier configured RX queue (configured by hw_tc) in tc_add_vlan_flow(),
    this patch introduces stmmac_rfs_entry as driver-side flow_cls_offload
    record for 'RX frame steering' tc flower, currently used for VLAN
    priority. The implementation has taken consideration for future extension
    to include other type RX frame steering such as EtherType based.
    
    v2:
     - Clean up overly extensive backtrace and rewrite git message to better
       explain the kernel NULL pointer issue.
    
    Fixes: 0e039f5 ("net: stmmac: add RX frame steering based on VLAN priority in tc flower")
    Tested-by: Kurt Kanzenbach <kurt@linutronix.de>
    Signed-off-by: Ong Boon Leong <boon.leong.ong@intel.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    elvinongbl authored and davem330 committed Dec 14, 2021
  11. mac80211: do drv_reconfig_complete() before restarting all

    When we reconfigure, the driver might do some things to complete
    the reconfiguration. It's strange and could be broken in some
    cases because we restart other works (e.g. remain-on-channel and
    TX) before this happens, yet only start queues later.
    
    Change this to do the reconfig complete when reconfiguration is
    actually complete, not when we've already started doing other
    things again.
    
    For iwlwifi, this should fix a race where the reconfig can race
    with TX, for ath10k and ath11k that also use this it won't make
    a difference because they just start queues there, and mac80211
    also stopped the queues and will restart them later as before.
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Link: https://lore.kernel.org/r/iwlwifi.20211129152938.cab99f22fe19.Iefe494687f15fd85f77c1b989d1149c8efdfdc36@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    jmberg-intel committed Dec 14, 2021
  12. mac80211: mark TX-during-stop for TX in in_reconfig

    Mark TXQs as having seen transmit while they were stopped if
    we bail out of drv_wake_tx_queue() due to reconfig, so that
    the queue wake after this will make them catch up. This is
    particularly necessary for when TXQs are used for management
    packets since those TXQs won't see a lot of traffic that'd
    make them catch up later.
    
    Cc: stable@vger.kernel.org
    Fixes: 4856bfd ("mac80211: do not call driver wake_tx_queue op during reconfig")
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Link: https://lore.kernel.org/r/iwlwifi.20211129152938.4573a221c0e1.I0d1d5daea3089be3fc0dccc92991b0f8c5677f0c@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    jmberg-intel committed Dec 14, 2021
  13. mac80211: update channel context before station state

    Currently channel context is updated only after station got an update about
    new assoc state, this results in station using the old channel context.
    
    Fix this by moving the update channel context before updating station,
    enabling the driver to immediately use the updated channel context in
    the new assoc state.
    
    Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Link: https://lore.kernel.org/r/iwlwifi.20211129152938.1c80c17ffd8a.I94ae31378b363c1182cfdca46c4b7e7165cff984@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Mordechay Goodstein authored and jmberg-intel committed Dec 14, 2021
  14. mac80211: Fix the size used for building probe request

    Instead of using the hard-coded value of '100' use the correct
    scan IEs length as calculated during HW registration to mac80211.
    
    Signed-off-by: Ilan Peer <ilan.peer@intel.com>
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Link: https://lore.kernel.org/r/iwlwifi.20211129152938.0a82d6891719.I8ded1f2e0bccb9e71222c945666bcd86537f2e35@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    ilanpeer2 authored and jmberg-intel committed Dec 14, 2021
  15. mac80211: fix lookup when adding AddBA extension element

    We should be doing the HE capabilities lookup based on the full
    interface type so if P2P doesn't have HE but client has it doesn't
    get confused. Fix that.
    
    Fixes: 2ab4587 ("mac80211: add support for the ADDBA extension element")
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Link: https://lore.kernel.org/r/iwlwifi.20211129152938.010fc1d61137.If3a468145f29d670cb00a693bed559d8290ba693@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    jmberg-intel committed Dec 14, 2021
  16. mac80211: validate extended element ID is present

    Before attempting to parse an extended element, verify that
    the extended element ID is present.
    
    Fixes: 41cbb0f ("mac80211: add support for HE")
    Reported-by: syzbot+59bdff68edce82e393b6@syzkaller.appspotmail.com
    Link: https://lore.kernel.org/r/20211211201023.f30a1b128c07.I5cacc176da94ba316877c6e10fe3ceec8b4dbd7d@changeid
    Cc: stable@vger.kernel.org
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    jmberg-intel committed Dec 14, 2021
  17. cfg80211: Acquire wiphy mutex on regulatory work

    The function cfg80211_reg_can_beacon_relax() expects wiphy
    mutex to be held when it is being called. However, when
    reg_leave_invalid_chans() is called the mutex is not held.
    Fix it by acquiring the lock before calling the function.
    
    Fixes: a05829a ("cfg80211: avoid holding the RTNL when calling the driver")
    Signed-off-by: Ilan Peer <ilan.peer@intel.com>
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Link: https://lore.kernel.org/r/iwlwifi.20211202152831.527686cda037.I40ad9372a47cbad53b4aae7b5a6ccc0dc3fddf8b@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    ilanpeer2 authored and jmberg-intel committed Dec 14, 2021
  18. mac80211: agg-tx: don't schedule_and_wake_txq() under sta->lock

    When we call ieee80211_agg_start_txq(), that will in turn call
    schedule_and_wake_txq(). Called from ieee80211_stop_tx_ba_cb()
    this is done under sta->lock, which leads to certain circular
    lock dependencies, as reported by Chris Murphy:
    https://lore.kernel.org/r/CAJCQCtSXJ5qA4bqSPY=oLRMbv-irihVvP7A2uGutEbXQVkoNaw@mail.gmail.com
    
    In general, ieee80211_agg_start_txq() is usually not called
    with sta->lock held, only in this one place. But it's always
    called with sta->ampdu_mlme.mtx held, and that's therefore
    clearly sufficient.
    
    Change ieee80211_stop_tx_ba_cb() to also call it without the
    sta->lock held, by factoring it out of ieee80211_remove_tid_tx()
    (which is only called in this one place).
    
    This breaks the locking chain and makes it less likely that
    we'll have similar locking chain problems in the future.
    
    Fixes: ba8c3d6 ("mac80211: add an intermediate software queue implementation")
    Reported-by: Chris Murphy <lists@colorremedies.com>
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Link: https://lore.kernel.org/r/iwlwifi.20211202152554.f519884c8784.I555fef8e67d93fff3d9a304886c4a9f8b322e591@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    jmberg-intel committed Dec 14, 2021
  19. nl80211: remove reload flag from regulatory_request

    This removes the previously unused reload flag, which was introduced in
    1eda919.
    The request is handled as NL80211_REGDOM_SET_BY_CORE, which is parsed
    unconditionally.
    
    Reported-by: kernel test robot <lkp@intel.com>
    Reported-by: Nathan Chancellor <nathan@kernel.org>
    Fixes: 1eda919 ("nl80211: reset regdom when reloading regdb")
    Link: https://lore.kernel.org/all/YaZuKYM5bfWe2Urn@archlinux-ax161/
    Signed-off-by: Finn Behrens <me@kloenk.de>
    Reviewed-by: Nathan Chancellor <nathan@kernel.org>
    Link: https://lore.kernel.org/r/YadvTolO8rQcNCd/@gimli.kloenk.dev
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Kloenk authored and jmberg-intel committed Dec 14, 2021
  20. mac80211: send ADDBA requests using the tid/queue of the aggregation …

    …session
    
    Sending them out on a different queue can cause a race condition where a
    number of packets in the queue may be discarded by the receiver, because
    the ADDBA request is sent too early.
    This affects any driver with software A-MPDU setup which does not allocate
    packet seqno in hardware on tx, regardless of whether iTXQ is used or not.
    The only driver I've seen that explicitly deals with this issue internally
    is mwl8k.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Felix Fietkau <nbd@nbd.name>
    Link: https://lore.kernel.org/r/20211202124533.80388-1-nbd@nbd.name
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    nbd168 authored and jmberg-intel committed Dec 14, 2021
Older