1. 10 10月, 2020 23 次提交
  2. 09 10月, 2020 17 次提交
    • E
      net/sched: get rid of qdisc->padded · 846e463a
      Eric Dumazet 提交于
      kmalloc() of sufficiently big portion of memory is cache-aligned
      in regular conditions. If some debugging options are used,
      there is no reason qdisc structures would need 64-byte alignment
      if most other kernel structures are not aligned.
      
      This get rid of QDISC_ALIGN and QDISC_ALIGNTO.
      
      Addition of privdata field will help implementing
      the reverse of qdisc_priv() and documents where
      the private data is.
      Signed-off-by: NEric Dumazet <edumazet@google.com>
      Cc: Allen Pais <allen.lkml@gmail.com>
      Acked-by: NCong Wang <xiyou.wangcong@gmail.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      846e463a
    • M
      selftests: mptcp: interpret \n as a new line · 036dfd83
      Matthieu Baerts 提交于
      In case of errors, this message was printed:
      
        (...)
        balanced bwidth with unbalanced delay       5233 max 5005  [ fail ]
        client exit code 0, server 0
        \nnetns ns3-0-EwnkPH socket stat for 10003:
        (...)
      
      Obviously, the idea was to add a new line before the socket stat and not
      print "\nnetns".
      
      The commit 8b974778 ("selftests: mptcp: interpret \n as a new line")
      is very similar to this one. But the modification in simult_flows.sh was
      missed because this commit above was done in parallel to one here below.
      
      Fixes: 1a418cb8 ("mptcp: simult flow self-tests")
      Signed-off-by: NMatthieu Baerts <matthieu.baerts@tessares.net>
      Acked-by: NPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      036dfd83
    • V
      net: mscc: ocelot: add missing VCAP ES0 and IS1 regmaps for VSC7514 · de997e54
      Vladimir Oltean 提交于
      Without these definitions, the driver will crash in:
      mscc_ocelot_probe
      -> ocelot_init
         -> ocelot_vcap_init
           -> __ocelot_target_read_ix
      
      I missed this because I did not have the VSC7514 hardware to test, only
      the VSC9959 and VSC9953, and the probing part is different.
      
      Fixes: e3aea296 ("net: mscc: ocelot: add definitions for VCAP ES0 keys, actions and target")
      Fixes: a61e365d ("net: mscc: ocelot: add definitions for VCAP IS1 keys, actions and target")
      Reported-by: NDivya Koppera <Divya.Koppera@microchip.com>
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      de997e54
    • P
      mptcp: fix infinite loop on recvmsg()/worker() race. · d9fb8c50
      Paolo Abeni 提交于
      If recvmsg() and the workqueue race to dequeue the data
      pending on some subflow, the current mapping for such
      subflow covers several skbs and some of them have not
      reached yet the received, either the worker or recvmsg()
      can find a subflow with the data_avail flag set - since
      the current mapping is valid and in sequence - but no
      skbs in the receive queue - since the other entity just
      processed them.
      
      The above will lead to an unbounded loop in __mptcp_move_skbs()
      and a subsequent hang of any task trying to acquiring the msk
      socket lock.
      
      This change addresses the issue stopping the __mptcp_move_skbs()
      loop as soon as we detect the above race (empty receive queue
      with data_avail set).
      
      Reported-and-tested-by: syzbot+fcf8ca5817d6e92c6567@syzkaller.appspotmail.com
      Fixes: ab174ad8 ("mptcp: move ooo skbs into msk out of order queue.")
      Signed-off-by: NPaolo Abeni <pabeni@redhat.com>
      Reviewed-by: NMat Martineau <mathew.j.martineau@linux.intel.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      d9fb8c50
    • A
      cxgb4: convert tasklets to use new tasklet_setup() API · 0eb484ee
      Allen Pais 提交于
      In preparation for unconditionally passing the
      struct tasklet_struct pointer to all tasklet
      callbacks, switch to using the new tasklet_setup()
      and from_tasklet() to pass the tasklet pointer explicitly.
      Signed-off-by: NRomain Perier <romain.perier@gmail.com>
      Signed-off-by: NAllen Pais <apais@linux.microsoft.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      0eb484ee
    • J
      ethtool: correct policy for ETHTOOL_MSG_CHANNELS_SET · fd15dd05
      Johannes Berg 提交于
      This accidentally got wired up to the *get* policy instead
      of the *set* policy, causing operations to be rejected. Fix
      it by wiring up the correct policy instead.
      
      Fixes: 5028588b ("ethtool: wire up set policies to ops")
      Reported-by: NLeon Romanovsky <leon@kernel.org>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Tested-by: NLeon Romanovsky <leonro@nvidia.com>
      Reviewed-by: NJakub Kicinski <kuba@kernel.org>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      fd15dd05
    • J
      ethtool: strset: allow ETHTOOL_A_STRSET_COUNTS_ONLY attr · db972e53
      Johannes Berg 提交于
      The ETHTOOL_A_STRSET_COUNTS_ONLY flag attribute was previously
      not allowed to be used, but now due to the policy size reduction
      we would access the tb[] array out of bounds since we tried to
      check for the attribute despite it not being accepted.
      
      Fix both issues by adding it correctly to the appropriate policy.
      
      Fixes: ff419afa ("ethtool: trim policy tables")
      Fixes: 71921690 ("ethtool: provide string sets with STRSET_GET request")
      Reported-by: NLeon Romanovsky <leon@kernel.org>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Tested-by: NLeon Romanovsky <leonro@nvidia.com>
      Reviewed-by: NJakub Kicinski <kuba@kernel.org>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      db972e53
    • J
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net · 9d49aea1
      Jakub Kicinski 提交于
      Small conflict around locking in rxrpc_process_event() -
      channel_lock moved to bundle in next, while state lock
      needs _bh() from net.
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      9d49aea1
    • L
      Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost · 3fdd47c3
      Linus Torvalds 提交于
      Pull vhost fixes from Michael Tsirkin:
       "Some last minute vhost,vdpa fixes.
      
        The last two of them haven't been in next but they do seem kind of
        obvious, very small and safe, fix bugs reported in the field, and they
        are both in a new mlx5 vdpa driver, so it's not like we can introduce
        regressions"
      
      * tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost:
        vdpa/mlx5: Fix dependency on MLX5_CORE
        vdpa/mlx5: should keep avail_index despite device status
        vhost-vdpa: fix page pinning leakage in error path
        vhost-vdpa: fix vhost_vdpa_map() on error condition
        vhost: Don't call log_access_ok() when using IOTLB
        vhost: Use vhost_get_used_size() in vhost_vring_set_addr()
        vhost: Don't call access_ok() when using IOTLB
        vhost vdpa: fix vhost_vdpa_open error handling
      3fdd47c3
    • L
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net · 6288c1d8
      Linus Torvalds 提交于
      Pull networking fixes from Jakub Kicinski:
       "One more set of fixes from the networking tree:
      
         - add missing input validation in nl80211_del_key(), preventing
           out-of-bounds access
      
         - last minute fix / improvement of a MRP netlink (uAPI) interface
           introduced in 5.9 (current) release
      
         - fix "unresolved symbol" build error under CONFIG_NET w/o
           CONFIG_INET due to missing tcp_timewait_sock and inet_timewait_sock
           BTF.
      
         - fix 32 bit sub-register bounds tracking in the bpf verifier for OR
           case
      
         - tcp: fix receive window update in tcp_add_backlog()
      
         - openvswitch: handle DNAT tuple collision in conntrack-related code
      
         - r8169: wait for potential PHY reset to finish after applying a FW
           file, avoiding unexpected PHY behaviour and failures later on
      
         - mscc: fix tail dropping watermarks for Ocelot switches
      
         - avoid use-after-free in macsec code after a call to the GRO layer
      
         - avoid use-after-free in sctp error paths
      
         - add a device id for Cellient MPL200 WWAN card
      
         - rxrpc fixes:
            - fix the xdr encoding of the contents read from an rxrpc key
            - fix a BUG() for a unsupported encoding type.
            - fix missing _bh lock annotations.
            - fix acceptance handling for an incoming call where the incoming
              call is encrypted.
            - the server token keyring isn't network namespaced - it belongs
              to the server, so there's no need. Namespacing it means that
              request_key() fails to find it.
            - fix a leak of the server keyring"
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (21 commits)
        net: usb: qmi_wwan: add Cellient MPL200 card
        macsec: avoid use-after-free in macsec_handle_frame()
        r8169: consider that PHY reset may still be in progress after applying firmware
        openvswitch: handle DNAT tuple collision
        sctp: fix sctp_auth_init_hmacs() error path
        bridge: Netlink interface fix.
        net: wireless: nl80211: fix out-of-bounds access in nl80211_del_key()
        bpf: Fix scalar32_min_max_or bounds tracking
        tcp: fix receive window update in tcp_add_backlog()
        net: usb: rtl8150: set random MAC address when set_ethernet_addr() fails
        mptcp: more DATA FIN fixes
        net: mscc: ocelot: warn when encoding an out-of-bounds watermark value
        net: mscc: ocelot: divide watermark value by 60 when writing to SYS_ATOP
        net: qrtr: ns: Fix the incorrect usage of rcu_read_lock()
        rxrpc: Fix server keyring leak
        rxrpc: The server keyring isn't network-namespaced
        rxrpc: Fix accept on a connection that need securing
        rxrpc: Fix some missing _bh annotations on locking conn->state_lock
        rxrpc: Downgrade the BUG() for unsupported token type in rxrpc_read()
        rxrpc: Fix rxkad token xdr encoding
        ...
      6288c1d8
    • E
      vdpa/mlx5: Fix dependency on MLX5_CORE · aff90770
      Eli Cohen 提交于
      Remove propmt for selecting MLX5_VDPA by the user and modify
      MLX5_VDPA_NET to select MLX5_VDPA. Also modify MLX5_VDPA_NET to depend
      on mlx5_core.
      
      This fixes an issue where configuration sets 'y' for MLX5_VDPA_NET while
      MLX5_CORE is compiled as a module causing link errors.
      Reported-by: Nkernel test robot <lkp@intel.com>
      Fixes: 1a86b377 ("vdpa/mlx5: Add VDPA driver for supported mlx5 device")s
      Signed-off-by: NEli Cohen <elic@nvidia.com>
      Link: https://lore.kernel.org/r/20201007064011.GA50074@mtl-vdi-166.wap.labs.mlnxSigned-off-by: NMichael S. Tsirkin <mst@redhat.com>
      aff90770
    • S
      vdpa/mlx5: should keep avail_index despite device status · 3176e974
      Si-Wei Liu 提交于
      A VM with mlx5 vDPA has below warnings while being reset:
      
      vhost VQ 0 ring restore failed: -1: Resource temporarily unavailable (11)
      vhost VQ 1 ring restore failed: -1: Resource temporarily unavailable (11)
      
      We should allow userspace emulating the virtio device be
      able to get to vq's avail_index, regardless of vDPA device
      status. Save the index that was last seen when virtq was
      stopped, so that userspace doesn't complain.
      Signed-off-by: NSi-Wei Liu <si-wei.liu@oracle.com>
      Link: https://lore.kernel.org/r/1601583511-15138-1-git-send-email-si-wei.liu@oracle.comSigned-off-by: NMichael S. Tsirkin <mst@redhat.com>
      Acked-by: NEli Cohen <elic@nvidia.com>
      3176e974
    • W
      net: usb: qmi_wwan: add Cellient MPL200 card · 28802e7c
      Wilken Gottwalt 提交于
      Add usb ids of the Cellient MPL200 card.
      Signed-off-by: NWilken Gottwalt <wilken.gottwalt@mailbox.org>
      Acked-by: NBjørn Mork <bjorn@mork.no>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      28802e7c
    • E
      macsec: avoid use-after-free in macsec_handle_frame() · c7cc9200
      Eric Dumazet 提交于
      De-referencing skb after call to gro_cells_receive() is not allowed.
      We need to fetch skb->len earlier.
      
      Fixes: 5491e7c6 ("macsec: enable GRO and RPS on macsec devices")
      Signed-off-by: NEric Dumazet <edumazet@google.com>
      Cc: Paolo Abeni <pabeni@redhat.com>
      Acked-by: NPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      c7cc9200
    • H
      r8169: consider that PHY reset may still be in progress after applying firmware · 47dda786
      Heiner Kallweit 提交于
      Some firmware files trigger a PHY soft reset and don't wait for it to
      be finished. PHY register writes directly after applying the firmware
      may fail or provide unexpected results therefore. Fix this by waiting
      for bit BMCR_RESET to be cleared after applying firmware.
      
      There's nothing wrong with the referenced change, it's just that the
      fix will apply cleanly only after this change.
      
      Fixes: 89fbd26c ("r8169: fix firmware not resetting tp->ocp_base")
      Signed-off-by: NHeiner Kallweit <hkallweit1@gmail.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      47dda786
    • D
      openvswitch: handle DNAT tuple collision · 8aa7b526
      Dumitru Ceara 提交于
      With multiple DNAT rules it's possible that after destination
      translation the resulting tuples collide.
      
      For example, two openvswitch flows:
      nw_dst=10.0.0.10,tp_dst=10, actions=ct(commit,table=2,nat(dst=20.0.0.1:20))
      nw_dst=10.0.0.20,tp_dst=10, actions=ct(commit,table=2,nat(dst=20.0.0.1:20))
      
      Assuming two TCP clients initiating the following connections:
      10.0.0.10:5000->10.0.0.10:10
      10.0.0.10:5000->10.0.0.20:10
      
      Both tuples would translate to 10.0.0.10:5000->20.0.0.1:20 causing
      nf_conntrack_confirm() to fail because of tuple collision.
      
      Netfilter handles this case by allocating a null binding for SNAT at
      egress by default.  Perform the same operation in openvswitch for DNAT
      if no explicit SNAT is requested by the user and allocate a null binding
      for SNAT for packets in the "original" direction.
      
      Reported-at: https://bugzilla.redhat.com/1877128Suggested-by: NFlorian Westphal <fw@strlen.de>
      Fixes: 05752523 ("openvswitch: Interface with NAT.")
      Signed-off-by: NDumitru Ceara <dceara@redhat.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      8aa7b526
    • E
      sctp: fix sctp_auth_init_hmacs() error path · d42ee76e
      Eric Dumazet 提交于
      After freeing ep->auth_hmacs we have to clear the pointer
      or risk use-after-free as reported by syzbot:
      
      BUG: KASAN: use-after-free in sctp_auth_destroy_hmacs net/sctp/auth.c:509 [inline]
      BUG: KASAN: use-after-free in sctp_auth_destroy_hmacs net/sctp/auth.c:501 [inline]
      BUG: KASAN: use-after-free in sctp_auth_free+0x17e/0x1d0 net/sctp/auth.c:1070
      Read of size 8 at addr ffff8880a8ff52c0 by task syz-executor941/6874
      
      CPU: 0 PID: 6874 Comm: syz-executor941 Not tainted 5.9.0-rc8-syzkaller #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      Call Trace:
       __dump_stack lib/dump_stack.c:77 [inline]
       dump_stack+0x198/0x1fd lib/dump_stack.c:118
       print_address_description.constprop.0.cold+0xae/0x497 mm/kasan/report.c:383
       __kasan_report mm/kasan/report.c:513 [inline]
       kasan_report.cold+0x1f/0x37 mm/kasan/report.c:530
       sctp_auth_destroy_hmacs net/sctp/auth.c:509 [inline]
       sctp_auth_destroy_hmacs net/sctp/auth.c:501 [inline]
       sctp_auth_free+0x17e/0x1d0 net/sctp/auth.c:1070
       sctp_endpoint_destroy+0x95/0x240 net/sctp/endpointola.c:203
       sctp_endpoint_put net/sctp/endpointola.c:236 [inline]
       sctp_endpoint_free+0xd6/0x110 net/sctp/endpointola.c:183
       sctp_destroy_sock+0x9c/0x3c0 net/sctp/socket.c:4981
       sctp_v6_destroy_sock+0x11/0x20 net/sctp/socket.c:9415
       sk_common_release+0x64/0x390 net/core/sock.c:3254
       sctp_close+0x4ce/0x8b0 net/sctp/socket.c:1533
       inet_release+0x12e/0x280 net/ipv4/af_inet.c:431
       inet6_release+0x4c/0x70 net/ipv6/af_inet6.c:475
       __sock_release+0xcd/0x280 net/socket.c:596
       sock_close+0x18/0x20 net/socket.c:1277
       __fput+0x285/0x920 fs/file_table.c:281
       task_work_run+0xdd/0x190 kernel/task_work.c:141
       exit_task_work include/linux/task_work.h:25 [inline]
       do_exit+0xb7d/0x29f0 kernel/exit.c:806
       do_group_exit+0x125/0x310 kernel/exit.c:903
       __do_sys_exit_group kernel/exit.c:914 [inline]
       __se_sys_exit_group kernel/exit.c:912 [inline]
       __x64_sys_exit_group+0x3a/0x50 kernel/exit.c:912
       do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
       entry_SYSCALL_64_after_hwframe+0x44/0xa9
      RIP: 0033:0x43f278
      Code: Bad RIP value.
      RSP: 002b:00007fffe0995c38 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
      RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 000000000043f278
      RDX: 0000000000000000 RSI: 000000000000003c RDI: 0000000000000000
      RBP: 00000000004bf068 R08: 00000000000000e7 R09: ffffffffffffffd0
      R10: 0000000020000000 R11: 0000000000000246 R12: 0000000000000001
      R13: 00000000006d1180 R14: 0000000000000000 R15: 0000000000000000
      
      Allocated by task 6874:
       kasan_save_stack+0x1b/0x40 mm/kasan/common.c:48
       kasan_set_track mm/kasan/common.c:56 [inline]
       __kasan_kmalloc.constprop.0+0xbf/0xd0 mm/kasan/common.c:461
       kmem_cache_alloc_trace+0x174/0x300 mm/slab.c:3554
       kmalloc include/linux/slab.h:554 [inline]
       kmalloc_array include/linux/slab.h:593 [inline]
       kcalloc include/linux/slab.h:605 [inline]
       sctp_auth_init_hmacs+0xdb/0x3b0 net/sctp/auth.c:464
       sctp_auth_init+0x8a/0x4a0 net/sctp/auth.c:1049
       sctp_setsockopt_auth_supported net/sctp/socket.c:4354 [inline]
       sctp_setsockopt+0x477e/0x97f0 net/sctp/socket.c:4631
       __sys_setsockopt+0x2db/0x610 net/socket.c:2132
       __do_sys_setsockopt net/socket.c:2143 [inline]
       __se_sys_setsockopt net/socket.c:2140 [inline]
       __x64_sys_setsockopt+0xba/0x150 net/socket.c:2140
       do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
       entry_SYSCALL_64_after_hwframe+0x44/0xa9
      
      Freed by task 6874:
       kasan_save_stack+0x1b/0x40 mm/kasan/common.c:48
       kasan_set_track+0x1c/0x30 mm/kasan/common.c:56
       kasan_set_free_info+0x1b/0x30 mm/kasan/generic.c:355
       __kasan_slab_free+0xd8/0x120 mm/kasan/common.c:422
       __cache_free mm/slab.c:3422 [inline]
       kfree+0x10e/0x2b0 mm/slab.c:3760
       sctp_auth_destroy_hmacs net/sctp/auth.c:511 [inline]
       sctp_auth_destroy_hmacs net/sctp/auth.c:501 [inline]
       sctp_auth_init_hmacs net/sctp/auth.c:496 [inline]
       sctp_auth_init_hmacs+0x2b7/0x3b0 net/sctp/auth.c:454
       sctp_auth_init+0x8a/0x4a0 net/sctp/auth.c:1049
       sctp_setsockopt_auth_supported net/sctp/socket.c:4354 [inline]
       sctp_setsockopt+0x477e/0x97f0 net/sctp/socket.c:4631
       __sys_setsockopt+0x2db/0x610 net/socket.c:2132
       __do_sys_setsockopt net/socket.c:2143 [inline]
       __se_sys_setsockopt net/socket.c:2140 [inline]
       __x64_sys_setsockopt+0xba/0x150 net/socket.c:2140
       do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
       entry_SYSCALL_64_after_hwframe+0x44/0xa9
      
      Fixes: 1f485649 ("[SCTP]: Implement SCTP-AUTH internals")
      Signed-off-by: NEric Dumazet <edumazet@google.com>
      Cc: Vlad Yasevich <vyasevich@gmail.com>
      Cc: Neil Horman <nhorman@tuxdriver.com>
      Cc: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
      Acked-by: NMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      d42ee76e