1. 30 10月, 2020 1 次提交
    • A
      netem: fix zero division in tabledist · eadd1bef
      Aleksandr Nogikh 提交于
      Currently it is possible to craft a special netlink RTM_NEWQDISC
      command that can result in jitter being equal to 0x80000000. It is
      enough to set the 32 bit jitter to 0x02000000 (it will later be
      multiplied by 2^6) or just set the 64 bit jitter via
      TCA_NETEM_JITTER64. This causes an overflow during the generation of
      uniformly distributed numbers in tabledist(), which in turn leads to
      division by zero (sigma != 0, but sigma * 2 is 0).
      
      The related fragment of code needs 32-bit division - see commit
      9b0ed891 ("netem: remove unnecessary 64 bit modulus"), so switching to
      64 bit is not an option.
      
      Fix the issue by keeping the value of jitter within the range that can
      be adequately handled by tabledist() - [0;INT_MAX]. As negative std
      deviation makes no sense, take the absolute value of the passed value
      and cap it at INT_MAX. Inside tabledist(), switch to unsigned 32 bit
      arithmetic in order to prevent overflows.
      
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Signed-off-by: NAleksandr Nogikh <nogikh@google.com>
      Reported-by: syzbot+ec762a6342ad0d3c0d8f@syzkaller.appspotmail.com
      Acked-by: NStephen Hemminger <stephen@networkplumber.org>
      Link: https://lore.kernel.org/r/20201028170731.1383332-1-aleksandrnogikh@gmail.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      eadd1bef
  2. 28 10月, 2020 2 次提交
    • L
      net: protect tcf_block_unbind with block lock · d6535dca
      Leon Romanovsky 提交于
      The tcf_block_unbind() expects that the caller will take block->cb_lock
      before calling it, however the code took RTNL lock and dropped cb_lock
      instead. This causes to the following kernel panic.
      
       WARNING: CPU: 1 PID: 13524 at net/sched/cls_api.c:1488 tcf_block_unbind+0x2db/0x420
       Modules linked in: mlx5_ib mlx5_core mlxfw ptp pps_core act_mirred act_tunnel_key cls_flower vxlan ip6_udp_tunnel udp_tunnel dummy sch_ingress openvswitch nsh xt_conntrack xt_MASQUERADE nf_conntrack_netlink nfnetlink xt_addrtype iptable_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 br_netfilter rpcrdma rdma_ucm ib_iser libiscsi scsi_transport_iscsi ib_umad ib_ipoib rdma_cm iw_cm ib_cm ib_uverbs ib_core overlay [last unloaded: mlxfw]
       CPU: 1 PID: 13524 Comm: test-ecmp-add-v Tainted: G        W         5.9.0+ #1
       Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
       RIP: 0010:tcf_block_unbind+0x2db/0x420
       Code: ff 48 83 c4 40 5b 5d 41 5c 41 5d 41 5e 41 5f c3 49 8d bc 24 30 01 00 00 be ff ff ff ff e8 7d 7f 70 00 85 c0 0f 85 7b fd ff ff <0f> 0b e9 74 fd ff ff 48 c7 c7 dc 6a 24 84 e8 02 ec fe fe e9 55 fd
       RSP: 0018:ffff888117d17968 EFLAGS: 00010246
       RAX: 0000000000000000 RBX: ffff88812f713c00 RCX: 1ffffffff0848d5b
       RDX: 0000000000000001 RSI: ffff88814fbc8130 RDI: ffff888107f2b878
       RBP: 1ffff11022fa2f3f R08: 0000000000000000 R09: ffffffff84115a87
       R10: fffffbfff0822b50 R11: ffff888107f2b898 R12: ffff88814fbc8000
       R13: ffff88812f713c10 R14: ffff888117d17a38 R15: ffff88814fbc80c0
       FS:  00007f6593d36740(0000) GS:ffff8882a4f00000(0000) knlGS:0000000000000000
       CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
       CR2: 00005607a00758f8 CR3: 0000000131aea006 CR4: 0000000000170ea0
       Call Trace:
        tc_block_indr_cleanup+0x3e0/0x5a0
        ? tcf_block_unbind+0x420/0x420
        ? __mutex_unlock_slowpath+0xe7/0x610
        flow_indr_dev_unregister+0x5e2/0x930
        ? mlx5e_restore_tunnel+0xdf0/0xdf0 [mlx5_core]
        ? mlx5e_restore_tunnel+0xdf0/0xdf0 [mlx5_core]
        ? flow_indr_block_cb_alloc+0x3c0/0x3c0
        ? mlx5_db_free+0x37c/0x4b0 [mlx5_core]
        mlx5e_cleanup_rep_tx+0x8b/0xc0 [mlx5_core]
        mlx5e_detach_netdev+0xe5/0x120 [mlx5_core]
        mlx5e_vport_rep_unload+0x155/0x260 [mlx5_core]
        esw_offloads_disable+0x227/0x2b0 [mlx5_core]
        mlx5_eswitch_disable_locked.cold+0x38e/0x699 [mlx5_core]
        mlx5_eswitch_disable+0x94/0xf0 [mlx5_core]
        mlx5_device_disable_sriov+0x183/0x1f0 [mlx5_core]
        mlx5_core_sriov_configure+0xfd/0x230 [mlx5_core]
        sriov_numvfs_store+0x261/0x2f0
        ? sriov_drivers_autoprobe_store+0x110/0x110
        ? sysfs_file_ops+0x170/0x170
        ? sysfs_file_ops+0x117/0x170
        ? sysfs_file_ops+0x170/0x170
        kernfs_fop_write+0x1ff/0x3f0
        ? rcu_read_lock_any_held+0x6e/0x90
        vfs_write+0x1f3/0x620
        ksys_write+0xf9/0x1d0
        ? __x64_sys_read+0xb0/0xb0
        ? lockdep_hardirqs_on_prepare+0x273/0x3f0
        ? syscall_enter_from_user_mode+0x1d/0x50
        do_syscall_64+0x2d/0x40
        entry_SYSCALL_64_after_hwframe+0x44/0xa9
      
      <...>
      
       ---[ end trace bfdd028ada702879 ]---
      
      Fixes: 0fdcf78d ("net: use flow_indr_dev_setup_offload()")
      Signed-off-by: NLeon Romanovsky <leonro@nvidia.com>
      Link: https://lore.kernel.org/r/20201026123327.1141066-1-leon@kernel.orgSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      d6535dca
    • G
      net/sched: act_mpls: Add softdep on mpls_gso.ko · 501b72ae
      Guillaume Nault 提交于
      TCA_MPLS_ACT_PUSH and TCA_MPLS_ACT_MAC_PUSH might be used on gso
      packets. Such packets will thus require mpls_gso.ko for segmentation.
      
      v2: Drop dependency on CONFIG_NET_MPLS_GSO in Kconfig (from Jakub and
          David).
      
      Fixes: 2a2ea508 ("net: sched: add mpls manipulation actions to TC")
      Signed-off-by: NGuillaume Nault <gnault@redhat.com>
      Link: https://lore.kernel.org/r/1f6cab15bbd15666795061c55563aaf6a386e90e.1603708007.git.gnault@redhat.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      501b72ae
  3. 21 10月, 2020 3 次提交
    • D
      net/sched: act_tunnel_key: fix OOB write in case of IPv6 ERSPAN tunnels · a7a12b5a
      Davide Caratti 提交于
      the following command
      
       # tc action add action tunnel_key \
       > set src_ip 2001:db8::1 dst_ip 2001:db8::2 id 10 erspan_opts 1:6789:0:0
      
      generates the following splat:
      
       BUG: KASAN: slab-out-of-bounds in tunnel_key_copy_opts+0xcc9/0x1010 [act_tunnel_key]
       Write of size 4 at addr ffff88813f5f1cc8 by task tc/873
      
       CPU: 2 PID: 873 Comm: tc Not tainted 5.9.0+ #282
       Hardware name: Red Hat KVM, BIOS 1.11.1-4.module+el8.1.0+4066+0f1aadab 04/01/2014
       Call Trace:
        dump_stack+0x99/0xcb
        print_address_description.constprop.7+0x1e/0x230
        kasan_report.cold.13+0x37/0x7c
        tunnel_key_copy_opts+0xcc9/0x1010 [act_tunnel_key]
        tunnel_key_init+0x160c/0x1f40 [act_tunnel_key]
        tcf_action_init_1+0x5b5/0x850
        tcf_action_init+0x15d/0x370
        tcf_action_add+0xd9/0x2f0
        tc_ctl_action+0x29b/0x3a0
        rtnetlink_rcv_msg+0x341/0x8d0
        netlink_rcv_skb+0x120/0x380
        netlink_unicast+0x439/0x630
        netlink_sendmsg+0x719/0xbf0
        sock_sendmsg+0xe2/0x110
        ____sys_sendmsg+0x5ba/0x890
        ___sys_sendmsg+0xe9/0x160
        __sys_sendmsg+0xd3/0x170
        do_syscall_64+0x33/0x40
        entry_SYSCALL_64_after_hwframe+0x44/0xa9
       RIP: 0033:0x7f872a96b338
       Code: 89 02 48 c7 c0 ff ff ff ff eb b5 0f 1f 80 00 00 00 00 f3 0f 1e fa 48 8d 05 25 43 2c 00 8b 00 85 c0 75 17 b8 2e 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 58 c3 0f 1f 80 00 00 00 00 41 54 41 89 d4 55
       RSP: 002b:00007ffffe367518 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
       RAX: ffffffffffffffda RBX: 000000005f8f5aed RCX: 00007f872a96b338
       RDX: 0000000000000000 RSI: 00007ffffe367580 RDI: 0000000000000003
       RBP: 0000000000000000 R08: 0000000000000001 R09: 000000000000001c
       R10: 000000000000000b R11: 0000000000000246 R12: 0000000000000001
       R13: 0000000000686760 R14: 0000000000000601 R15: 0000000000000000
      
       Allocated by task 873:
        kasan_save_stack+0x19/0x40
        __kasan_kmalloc.constprop.7+0xc1/0xd0
        __kmalloc+0x151/0x310
        metadata_dst_alloc+0x20/0x40
        tunnel_key_init+0xfff/0x1f40 [act_tunnel_key]
        tcf_action_init_1+0x5b5/0x850
        tcf_action_init+0x15d/0x370
        tcf_action_add+0xd9/0x2f0
        tc_ctl_action+0x29b/0x3a0
        rtnetlink_rcv_msg+0x341/0x8d0
        netlink_rcv_skb+0x120/0x380
        netlink_unicast+0x439/0x630
        netlink_sendmsg+0x719/0xbf0
        sock_sendmsg+0xe2/0x110
        ____sys_sendmsg+0x5ba/0x890
        ___sys_sendmsg+0xe9/0x160
        __sys_sendmsg+0xd3/0x170
        do_syscall_64+0x33/0x40
        entry_SYSCALL_64_after_hwframe+0x44/0xa9
      
       The buggy address belongs to the object at ffff88813f5f1c00
        which belongs to the cache kmalloc-256 of size 256
       The buggy address is located 200 bytes inside of
        256-byte region [ffff88813f5f1c00, ffff88813f5f1d00)
       The buggy address belongs to the page:
       page:0000000011b48a19 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x13f5f0
       head:0000000011b48a19 order:1 compound_mapcount:0
       flags: 0x17ffffc0010200(slab|head)
       raw: 0017ffffc0010200 0000000000000000 0000000d00000001 ffff888107c43400
       raw: 0000000000000000 0000000080100010 00000001ffffffff 0000000000000000
       page dumped because: kasan: bad access detected
      
       Memory state around the buggy address:
        ffff88813f5f1b80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
        ffff88813f5f1c00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
       >ffff88813f5f1c80: 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc
                                                     ^
        ffff88813f5f1d00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
        ffff88813f5f1d80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
      
      using IPv6 tunnels, act_tunnel_key allocates a fixed amount of memory for
      the tunnel metadata, but then it expects additional bytes to store tunnel
      specific metadata with tunnel_key_copy_opts().
      
      Fix the arguments of __ipv6_tun_set_dst(), so that 'md_size' contains the
      size previously computed by tunnel_key_get_opts_len(), like it's done for
      IPv4 tunnels.
      
      Fixes: 0ed5269f ("net/sched: add tunnel option support to act_tunnel_key")
      Reported-by: NShuang Li <shuali@redhat.com>
      Signed-off-by: NDavide Caratti <dcaratti@redhat.com>
      Acked-by: NCong Wang <xiyou.wangcong@gmail.com>
      Link: https://lore.kernel.org/r/36ebe969f6d13ff59912d6464a4356fe6f103766.1603231100.git.dcaratti@redhat.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      a7a12b5a
    • G
      net/sched: act_gate: Unlock ->tcfa_lock in tc_setup_flow_action() · b1307621
      Guillaume Nault 提交于
      We need to jump to the "err_out_locked" label when
      tcf_gate_get_entries() fails. Otherwise, tc_setup_flow_action() exits
      with ->tcfa_lock still held.
      
      Fixes: d29bdd69 ("net: schedule: add action gate offloading")
      Signed-off-by: NGuillaume Nault <gnault@redhat.com>
      Acked-by: NCong Wang <xiyou.wangcong@gmail.com>
      Link: https://lore.kernel.org/r/12f60e385584c52c22863701c0185e40ab08a7a7.1603207948.git.gnault@redhat.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      b1307621
    • R
      net/sched: act_ct: Fix adding udp port mangle operation · 47b5d2a1
      Roi Dayan 提交于
      Need to use the udp header type and not tcp.
      
      Fixes: 9c26ba9b ("net/sched: act_ct: Instantiate flow table entry actions")
      Signed-off-by: NRoi Dayan <roid@nvidia.com>
      Reviewed-by: NPaul Blakey <paulb@nvidia.com>
      Link: https://lore.kernel.org/r/20201019090244.3015186-1-roid@nvidia.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      47b5d2a1
  4. 09 10月, 2020 1 次提交
  5. 05 10月, 2020 1 次提交
    • C
      net_sched: check error pointer in tcf_dump_walker() · 580e4273
      Cong Wang 提交于
      Although we take RTNL on dump path, it is possible to
      skip RTNL on insertion path. So the following race condition
      is possible:
      
      rtnl_lock()		// no rtnl lock
      			mutex_lock(&idrinfo->lock);
      			// insert ERR_PTR(-EBUSY)
      			mutex_unlock(&idrinfo->lock);
      tc_dump_action()
      rtnl_unlock()
      
      So we have to skip those temporary -EBUSY entries on dump path
      too.
      
      Reported-and-tested-by: syzbot+b47bc4f247856fb4d9e1@syzkaller.appspotmail.com
      Fixes: 0fedc63f ("net_sched: commit action insertions together")
      Cc: Vlad Buslov <vladbu@mellanox.com>
      Cc: Jamal Hadi Salim <jhs@mojatatu.com>
      Cc: Jiri Pirko <jiri@resnulli.us>
      Signed-off-by: NCong Wang <xiyou.wangcong@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      580e4273
  6. 04 10月, 2020 2 次提交
  7. 29 9月, 2020 2 次提交
  8. 25 9月, 2020 2 次提交
    • C
      net_sched: commit action insertions together · 0fedc63f
      Cong Wang 提交于
      syzbot is able to trigger a failure case inside the loop in
      tcf_action_init(), and when this happens we clean up with
      tcf_action_destroy(). But, as these actions are already inserted
      into the global IDR, other parallel process could free them
      before tcf_action_destroy(), then we will trigger a use-after-free.
      
      Fix this by deferring the insertions even later, after the loop,
      and committing all the insertions in a separate loop, so we will
      never fail in the middle of the insertions any more.
      
      One side effect is that the window between alloction and final
      insertion becomes larger, now it is more likely that the loop in
      tcf_del_walker() sees the placeholder -EBUSY pointer. So we have
      to check for error pointer in tcf_del_walker().
      
      Reported-and-tested-by: syzbot+2287853d392e4b42374a@syzkaller.appspotmail.com
      Fixes: 0190c1d4 ("net: sched: atomically check-allocate action")
      Cc: Vlad Buslov <vladbu@mellanox.com>
      Cc: Jamal Hadi Salim <jhs@mojatatu.com>
      Cc: Jiri Pirko <jiri@resnulli.us>
      Signed-off-by: NCong Wang <xiyou.wangcong@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      0fedc63f
    • C
      net_sched: defer tcf_idr_insert() in tcf_action_init_1() · e49d8c22
      Cong Wang 提交于
      All TC actions call tcf_idr_insert() for new action at the end
      of their ->init(), so we can actually move it to a central place
      in tcf_action_init_1().
      
      And once the action is inserted into the global IDR, other parallel
      process could free it immediately as its refcnt is still 1, so we can
      not fail after this, we need to move it after the goto action
      validation to avoid handling the failure case after insertion.
      
      This is found during code review, is not directly triggered by syzbot.
      And this prepares for the next patch.
      
      Cc: Vlad Buslov <vladbu@mellanox.com>
      Cc: Jamal Hadi Salim <jhs@mojatatu.com>
      Cc: Jiri Pirko <jiri@resnulli.us>
      Signed-off-by: NCong Wang <xiyou.wangcong@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      e49d8c22
  9. 15 9月, 2020 2 次提交
  10. 12 9月, 2020 1 次提交
  11. 11 9月, 2020 1 次提交
    • Y
      net: sch_generic: aviod concurrent reset and enqueue op for lockless qdisc · 2fb541c8
      Yunsheng Lin 提交于
      Currently there is concurrent reset and enqueue operation for the
      same lockless qdisc when there is no lock to synchronize the
      q->enqueue() in __dev_xmit_skb() with the qdisc reset operation in
      qdisc_deactivate() called by dev_deactivate_queue(), which may cause
      out-of-bounds access for priv->ring[] in hns3 driver if user has
      requested a smaller queue num when __dev_xmit_skb() still enqueue a
      skb with a larger queue_mapping after the corresponding qdisc is
      reset, and call hns3_nic_net_xmit() with that skb later.
      
      Reused the existing synchronize_net() in dev_deactivate_many() to
      make sure skb with larger queue_mapping enqueued to old qdisc(which
      is saved in dev_queue->qdisc_sleeping) will always be reset when
      dev_reset_queue() is called.
      
      Fixes: 6b3ba914 ("net: sched: allow qdiscs to handle locking")
      Signed-off-by: NYunsheng Lin <linyunsheng@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      2fb541c8
  12. 09 9月, 2020 1 次提交
  13. 05 9月, 2020 1 次提交
    • C
      act_ife: load meta modules before tcf_idr_check_alloc() · cc8e58f8
      Cong Wang 提交于
      The following deadlock scenario is triggered by syzbot:
      
      Thread A:				Thread B:
      tcf_idr_check_alloc()
      ...
      populate_metalist()
        rtnl_unlock()
      					rtnl_lock()
      					...
        request_module()			tcf_idr_check_alloc()
        rtnl_lock()
      
      At this point, thread A is waiting for thread B to release RTNL
      lock, while thread B is waiting for thread A to commit the IDR
      change with tcf_idr_insert() later.
      
      Break this deadlock situation by preloading ife modules earlier,
      before tcf_idr_check_alloc(), this is fine because we only need
      to load modules we need potentially.
      
      Reported-and-tested-by: syzbot+80e32b5d1f9923f8ace6@syzkaller.appspotmail.com
      Fixes: 0190c1d4 ("net: sched: atomically check-allocate action")
      Cc: Jamal Hadi Salim <jhs@mojatatu.com>
      Cc: Vlad Buslov <vladbu@mellanox.com>
      Cc: Jiri Pirko <jiri@resnulli.us>
      Signed-off-by: NCong Wang <xiyou.wangcong@gmail.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      cc8e58f8
  14. 28 8月, 2020 1 次提交
  15. 27 8月, 2020 1 次提交
    • V
      taprio: Fix using wrong queues in gate mask · 09e31cf0
      Vinicius Costa Gomes 提交于
      Since commit 9c66d156 ("taprio: Add support for hardware
      offloading") there's a bit of inconsistency when offloading schedules
      to the hardware:
      
      In software mode, the gate masks are specified in terms of traffic
      classes, so if say "sched-entry S 03 20000", it means that the traffic
      classes 0 and 1 are open for 20us; when taprio is offloaded to
      hardware, the gate masks are specified in terms of hardware queues.
      
      The idea here is to fix hardware offloading, so schedules in hardware
      and software mode have the same behavior. What's needed to do is to
      map traffic classes to queues when applying the offload to the driver.
      
      Fixes: 9c66d156 ("taprio: Add support for hardware offloading")
      Signed-off-by: NVinicius Costa Gomes <vinicius.gomes@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      09e31cf0
  16. 24 8月, 2020 1 次提交
  17. 21 8月, 2020 1 次提交
  18. 19 8月, 2020 1 次提交
  19. 04 8月, 2020 1 次提交
    • W
      net/sched: act_ct: fix miss set mru for ovs after defrag in act_ct · 038ebb1a
      wenxu 提交于
      When openvswitch conntrack offload with act_ct action. Fragment packets
      defrag in the ingress tc act_ct action and miss the next chain. Then the
      packet pass to the openvswitch datapath without the mru. The over
      mtu packet will be dropped in output action in openvswitch for over mtu.
      
      "kernel: net2: dropped over-mtu packet: 1528 > 1500"
      
      This patch add mru in the tc_skb_ext for adefrag and miss next chain
      situation. And also add mru in the qdisc_skb_cb. The act_ct set the mru
      to the qdisc_skb_cb when the packet defrag. And When the chain miss,
      The mru is set to tc_skb_ext which can be got by ovs datapath.
      
      Fixes: b57dc7c1 ("net/sched: Introduce action ct")
      Signed-off-by: Nwenxu <wenxu@ucloud.cn>
      Reviewed-by: NCong Wang <xiyou.wangcong@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      038ebb1a
  20. 01 8月, 2020 2 次提交
  21. 31 7月, 2020 1 次提交
  22. 29 7月, 2020 1 次提交
  23. 25 7月, 2020 2 次提交
  24. 21 7月, 2020 2 次提交
    • W
      net/sched: act_ct: fix restore the qdisc_skb_cb after defrag · ae372cb1
      wenxu 提交于
      The fragment packets do defrag in tcf_ct_handle_fragments
      will clear the skb->cb which make the qdisc_skb_cb clear
      too. So the qdsic_skb_cb should be store before defrag and
      restore after that.
      It also update the pkt_len after all the
      fragments finish the defrag to one packet and make the
      following actions counter correct.
      
      Fixes: b57dc7c1 ("net/sched: Introduce action ct")
      Signed-off-by: Nwenxu <wenxu@ucloud.cn>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ae372cb1
    • J
      sched: sch_api: add missing rcu read lock to silence the warning · a8b7b2d0
      Jiri Pirko 提交于
      In case the qdisc_match_from_root function() is called from non-rcu path
      with rtnl mutex held, a suspiciout rcu usage warning appears:
      
      [  241.504354] =============================
      [  241.504358] WARNING: suspicious RCU usage
      [  241.504366] 5.8.0-rc4-custom-01521-g72a7c7d549c3 #32 Not tainted
      [  241.504370] -----------------------------
      [  241.504378] net/sched/sch_api.c:270 RCU-list traversed in non-reader section!!
      [  241.504382]
                     other info that might help us debug this:
      [  241.504388]
                     rcu_scheduler_active = 2, debug_locks = 1
      [  241.504394] 1 lock held by tc/1391:
      [  241.504398]  #0: ffffffff85a27850 (rtnl_mutex){+.+.}-{3:3}, at: rtnetlink_rcv_msg+0x49a/0xbd0
      [  241.504431]
                     stack backtrace:
      [  241.504440] CPU: 0 PID: 1391 Comm: tc Not tainted 5.8.0-rc4-custom-01521-g72a7c7d549c3 #32
      [  241.504446] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-2.fc32 04/01/2014
      [  241.504453] Call Trace:
      [  241.504465]  dump_stack+0x100/0x184
      [  241.504482]  lockdep_rcu_suspicious+0x153/0x15d
      [  241.504499]  qdisc_match_from_root+0x293/0x350
      
      Fix this by passing the rtnl held lockdep condition down to
      hlist_for_each_entry_rcu()
      Reported-by: NIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: NJiri Pirko <jiri@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a8b7b2d0
  25. 17 7月, 2020 3 次提交
  26. 14 7月, 2020 2 次提交
    • P
      net: sched: Pass qdisc reference in struct flow_block_offload · c40f4e50
      Petr Machata 提交于
      Previously, shared blocks were only relevant for the pseudo-qdiscs ingress
      and clsact. Recently, a qevent facility was introduced, which allows to
      bind blocks to well-defined slots of a qdisc instance. RED in particular
      got two qevents: early_drop and mark. Drivers that wish to offload these
      blocks will be sent the usual notification, and need to know which qdisc it
      is related to.
      
      To that end, extend flow_block_offload with a "sch" pointer, and initialize
      as appropriate. This prompts changes in the indirect block facility, which
      now tracks the scheduler in addition to the netdevice. Update signatures of
      several functions similarly.
      Signed-off-by: NPetr Machata <petrm@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c40f4e50
    • A
      net: sched: kerneldoc fixes · 90ac5d03
      Andrew Lunn 提交于
      Simple fixes which require no deep knowledge of the code.
      
      Cc: Jamal Hadi Salim <jhs@mojatatu.com>
      Cc: Cong Wang <xiyou.wangcong@gmail.com>
      Cc: Jiri Pirko <jiri@resnulli.us>
      Signed-off-by: NAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      90ac5d03
  27. 10 7月, 2020 1 次提交
    • C
      net_sched: fix a memory leak in atm_tc_init() · 306381ae
      Cong Wang 提交于
      When tcf_block_get() fails inside atm_tc_init(),
      atm_tc_put() is called to release the qdisc p->link.q.
      But the flow->ref prevents it to do so, as the flow->ref
      is still zero.
      
      Fix this by moving the p->link.ref initialization before
      tcf_block_get().
      
      Fixes: 6529eaba ("net: sched: introduce tcf block infractructure")
      Reported-and-tested-by: syzbot+d411cff6ab29cc2c311b@syzkaller.appspotmail.com
      Cc: Jamal Hadi Salim <jhs@mojatatu.com>
      Cc: Jiri Pirko <jiri@resnulli.us>
      Signed-off-by: NCong Wang <xiyou.wangcong@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      306381ae