1. 19 Aug, 2020 17 commits
  2. 11 Aug, 2020 23 commits
    • Greg Kroah-Hartman's avatar
      c14d30dc
    • Eric Biggers's avatar
      Smack: fix use-after-free in smk_write_relabel_self() · 67b4be30
      Eric Biggers authored
      commit beb4ee67 upstream.
      
      smk_write_relabel_self() frees memory from the task's credentials with
      no locking, which can easily cause a use-after-free because multiple
      tasks can share the same credentials structure.
      
      Fix this by using prepare_creds() and commit_creds() to correctly modify
      the task's credentials.
      
      Reproducer for "BUG: KASAN: use-after-free in smk_write_relabel_self":
      
      	#include <fcntl.h>
      	#include <pthread.h>
      	#include <unistd.h>
      
      	static void *thrproc(void *arg)
      	{
      		int fd = open("/sys/fs/smackfs/relabel-self", O_WRONLY);
      		for (;;) write(fd, "foo", 3);
      	}
      
      	int main()
      	{
      		pthread_t t;
      		pthread_create(&t, NULL, thrproc, NULL);
      		thrproc(NULL);
      	}
      
      Reported-by: syzbot+e6416dabb497a650da40@syzkaller.appspotmail.com
      Fixes: 38416e53 ("Smack: limited capability for changing process label")
      Cc: <stable@vger.kernel.org> # v4.4+
      Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
      Signed-off-by: default avatarCasey Schaufler <casey@schaufler-ca.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      67b4be30
    • Martyna Szapar's avatar
      i40e: Memory leak in i40e_config_iwarp_qvlist · 330aa3b4
      Martyna Szapar authored
      [ Upstream commit 0b636446 ]
      
      Added freeing the old allocation of vf->qvlist_info in function
      i40e_config_iwarp_qvlist before overwriting it with
      the new allocation.
      
      Fixes: e3219ce6 ("i40e: Add support for client interface for IWARP driver")
      Signed-off-by: default avatarMartyna Szapar <martyna.szapar@intel.com>
      Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      Signed-off-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      330aa3b4
    • Martyna Szapar's avatar
      i40e: Fix of memory leak and integer truncation in i40e_virtchnl.c · 71d78161
      Martyna Szapar authored
      [ Upstream commit 24474f27 ]
      
      Fixed possible memory leak in i40e_vc_add_cloud_filter function:
      cfilter is being allocated and in some error conditions
      the function returns without freeing the memory.
      
      Fix of integer truncation from u16 (type of queue_id value) to u8
      when calling i40e_vc_isvalid_queue_id function.
      
      Fixes: e284fc28 ("i40e: Add and delete cloud filter")
      Signed-off-by: default avatarMartyna Szapar <martyna.szapar@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      Signed-off-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      71d78161
    • Grzegorz Siwik's avatar
      i40e: Wrong truncation from u16 to u8 · 48a9be93
      Grzegorz Siwik authored
      [ Upstream commit c004804d ]
      
      In this patch fixed wrong truncation method from u16 to u8 during
      validation.
      
      It was changed by changing u8 to u32 parameter in method declaration
      and arguments were changed to u32.
      
      Fixes: 5c3c48ac ("i40e: implement virtual device interface")
      Signed-off-by: default avatarGrzegorz Siwik <grzegorz.siwik@intel.com>
      Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      Signed-off-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      48a9be93
    • Sergey Nemov's avatar
      i40e: add num_vectors checker in iwarp handler · 43a7e1cf
      Sergey Nemov authored
      [ Upstream commit 7015ca3d ]
      
      Field num_vectors from struct virtchnl_iwarp_qvlist_info should not be
      larger than num_msix_vectors_vf in the hw struct.  The iwarp uses the
      same set of vectors as the LAN VF driver.
      
      Fixes: e3219ce6 ("i40e: Add support for client interface for IWARP driver")
      Signed-off-by: default avatarSergey Nemov <sergey.nemov@intel.com>
      Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      Signed-off-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      43a7e1cf
    • David Howells's avatar
      rxrpc: Fix race between recvmsg and sendmsg on immediate call failure · 46a41ed2
      David Howells authored
      [ Upstream commit 65550098 ]
      
      There's a race between rxrpc_sendmsg setting up a call, but then failing to
      send anything on it due to an error, and recvmsg() seeing the call
      completion occur and trying to return the state to the user.
      
      An assertion fails in rxrpc_recvmsg() because the call has already been
      released from the socket and is about to be released again as recvmsg deals
      with it.  (The recvmsg_q queue on the socket holds a ref, so there's no
      problem with use-after-free.)
      
      We also have to be careful not to end up reporting an error twice, in such
      a way that both returns indicate to userspace that the user ID supplied
      with the call is no longer in use - which could cause the client to
      malfunction if it recycles the user ID fast enough.
      
      Fix this by the following means:
      
       (1) When sendmsg() creates a call after the point that the call has been
           successfully added to the socket, don't return any errors through
           sendmsg(), but rather complete the call and let recvmsg() retrieve
           them.  Make sendmsg() return 0 at this point.  Further calls to
           sendmsg() for that call will fail with ESHUTDOWN.
      
           Note that at this point, we haven't send any packets yet, so the
           server doesn't yet know about the call.
      
       (2) If sendmsg() returns an error when it was expected to create a new
           call, it means that the user ID wasn't used.
      
       (3) Mark the call disconnected before marking it completed to prevent an
           oops in rxrpc_release_call().
      
       (4) recvmsg() will then retrieve the error and set MSG_EOR to indicate
           that the user ID is no longer known by the kernel.
      
      An oops like the following is produced:
      
      	kernel BUG at net/rxrpc/recvmsg.c:605!
      	...
      	RIP: 0010:rxrpc_recvmsg+0x256/0x5ae
      	...
      	Call Trace:
      	 ? __init_waitqueue_head+0x2f/0x2f
      	 ____sys_recvmsg+0x8a/0x148
      	 ? import_iovec+0x69/0x9c
      	 ? copy_msghdr_from_user+0x5c/0x86
      	 ___sys_recvmsg+0x72/0xaa
      	 ? __fget_files+0x22/0x57
      	 ? __fget_light+0x46/0x51
      	 ? fdget+0x9/0x1b
      	 do_recvmmsg+0x15e/0x232
      	 ? _raw_spin_unlock+0xa/0xb
      	 ? vtime_delta+0xf/0x25
      	 __x64_sys_recvmmsg+0x2c/0x2f
      	 do_syscall_64+0x4c/0x78
      	 entry_SYSCALL_64_after_hwframe+0x44/0xa9
      
      Fixes: 357f5ef6 ("rxrpc: Call rxrpc_release_call() on error in rxrpc_new_client_call()")
      Reported-by: syzbot+b54969381df354936d96@syzkaller.appspotmail.com
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Reviewed-by: default avatarMarc Dionne <marc.dionne@auristor.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      46a41ed2
    • Willem de Bruijn's avatar
      selftests/net: relax cpu affinity requirement in msg_zerocopy test · 615214ab
      Willem de Bruijn authored
      [ Upstream commit 16f6458f ]
      
      The msg_zerocopy test pins the sender and receiver threads to separate
      cores to reduce variance between runs.
      
      But it hardcodes the cores and skips core 0, so it fails on machines
      with the selected cores offline, or simply fewer cores.
      
      The test mainly gives code coverage in automated runs. The throughput
      of zerocopy ('-z') and non-zerocopy runs is logged for manual
      inspection.
      
      Continue even when sched_setaffinity fails. Just log to warn anyone
      interpreting the data.
      
      Fixes: 07b65c5b ("test: add msg_zerocopy test")
      Reported-by: default avatarColin Ian King <colin.king@canonical.com>
      Signed-off-by: default avatarWillem de Bruijn <willemb@google.com>
      Acked-by: default avatarColin Ian King <colin.king@canonical.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      615214ab
    • Hangbin Liu's avatar
      Revert "vxlan: fix tos value before xmit" · 719a92fa
      Hangbin Liu authored
      [ Upstream commit a0dced17 ]
      
      This reverts commit 71130f29.
      
      In commit 71130f29 ("vxlan: fix tos value before xmit") we want to
      make sure the tos value are filtered by RT_TOS() based on RFC1349.
      
             0     1     2     3     4     5     6     7
          +-----+-----+-----+-----+-----+-----+-----+-----+
          |   PRECEDENCE    |          TOS          | MBZ |
          +-----+-----+-----+-----+-----+-----+-----+-----+
      
      But RFC1349 has been obsoleted by RFC2474. The new DSCP field defined like
      
             0     1     2     3     4     5     6     7
          +-----+-----+-----+-----+-----+-----+-----+-----+
          |          DS FIELD, DSCP           | ECN FIELD |
          +-----+-----+-----+-----+-----+-----+-----+-----+
      
      So with
      
      IPTOS_TOS_MASK          0x1E
      RT_TOS(tos)		((tos)&IPTOS_TOS_MASK)
      
      the first 3 bits DSCP info will get lost.
      
      To take all the DSCP info in xmit, we should revert the patch and just push
      all tos bits to ip_tunnel_ecn_encap(), which will handling ECN field later.
      
      Fixes: 71130f29 ("vxlan: fix tos value before xmit")
      Signed-off-by: default avatarHangbin Liu <liuhangbin@gmail.com>
      Acked-by: default avatarGuillaume Nault <gnault@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      719a92fa
    • Peilin Ye's avatar
      openvswitch: Prevent kernel-infoleak in ovs_ct_put_key() · 7fc4eec2
      Peilin Ye authored
      [ Upstream commit 9aba6c5b ]
      
      ovs_ct_put_key() is potentially copying uninitialized kernel stack memory
      into socket buffers, since the compiler may leave a 3-byte hole at the end
      of `struct ovs_key_ct_tuple_ipv4` and `struct ovs_key_ct_tuple_ipv6`. Fix
      it by initializing `orig` with memset().
      
      Fixes: 9dd7f890 ("openvswitch: Add original direction conntrack tuple to sw_flow_key.")
      Suggested-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarPeilin Ye <yepeilin.cs@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7fc4eec2
    • Xin Long's avatar
      net: thunderx: use spin_lock_bh in nicvf_set_rx_mode_task() · 55589dfa
      Xin Long authored
      [ Upstream commit bab9693a ]
      
      A dead lock was triggered on thunderx driver:
      
              CPU0                    CPU1
              ----                    ----
         [01] lock(&(&nic->rx_mode_wq_lock)->rlock);
                                 [11] lock(&(&mc->mca_lock)->rlock);
                                 [12] lock(&(&nic->rx_mode_wq_lock)->rlock);
         [02] <Interrupt> lock(&(&mc->mca_lock)->rlock);
      
      The path for each is:
      
        [01] worker_thread() -> process_one_work() -> nicvf_set_rx_mode_task()
        [02] mld_ifc_timer_expire()
        [11] ipv6_add_dev() -> ipv6_dev_mc_inc() -> igmp6_group_added() ->
        [12] dev_mc_add() -> __dev_set_rx_mode() -> nicvf_set_rx_mode()
      
      To fix it, it needs to disable bh on [1], so that the timer on [2]
      wouldn't be triggered until rx_mode_wq_lock is released. So change
      to use spin_lock_bh() instead of spin_lock().
      
      Thanks to Paolo for helping with this.
      
      v1->v2:
        - post to netdev.
      Reported-by: default avatarRafael P. <rparrazo@redhat.com>
      Tested-by: default avatarDean Nelson <dnelson@redhat.com>
      Fixes: 469998c8 ("net: thunderx: prevent concurrent data re-writing by nicvf_set_rx_mode")
      Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      55589dfa
    • Lorenzo Bianconi's avatar
      net: gre: recompute gre csum for sctp over gre tunnels · 9ffa0b33
      Lorenzo Bianconi authored
      [ Upstream commit 622e32b7 ]
      
      The GRE tunnel can be used to transport traffic that does not rely on a
      Internet checksum (e.g. SCTP). The issue can be triggered creating a GRE
      or GRETAP tunnel and transmitting SCTP traffic ontop of it where CRC
      offload has been disabled. In order to fix the issue we need to
      recompute the GRE csum in gre_gso_segment() not relying on the inner
      checksum.
      The issue is still present when we have the CRC offload enabled.
      In this case we need to disable the CRC offload if we require GRE
      checksum since otherwise skb_checksum() will report a wrong value.
      
      Fixes: 90017acc ("sctp: Add GSO support")
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
      Reviewed-by: default avatarMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9ffa0b33
    • Stephen Hemminger's avatar
      hv_netvsc: do not use VF device if link is down · d2a93f69
      Stephen Hemminger authored
      [ Upstream commit 7c9864bb ]
      
      If the accelerated networking SRIOV VF device has lost carrier
      use the synthetic network device which is available as backup
      path. This is a rare case since if VF link goes down, normally
      the VMBus device will also loose external connectivity as well.
      But if the communication is between two VM's on the same host
      the VMBus device will still work.
      Reported-by: default avatar"Shah, Ashish N" <ashish.n.shah@intel.com>
      Fixes: 0c195567 ("netvsc: transparent VF management")
      Signed-off-by: default avatarStephen Hemminger <stephen@networkplumber.org>
      Reviewed-by: default avatarHaiyang Zhang <haiyangz@microsoft.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d2a93f69
    • Johan Hovold's avatar
      net: lan78xx: replace bogus endpoint lookup · 9a70de92
      Johan Hovold authored
      [ Upstream commit ea060b35 ]
      
      Drop the bogus endpoint-lookup helper which could end up accepting
      interfaces based on endpoints belonging to unrelated altsettings.
      
      Note that the returned bulk pipes and interrupt endpoint descriptor
      were never actually used. Instead the bulk-endpoint numbers are
      hardcoded to 1 and 2 (matching the specification), while the interrupt-
      endpoint descriptor was assumed to be the third descriptor created by
      USB core.
      
      Try to bring some order to this by dropping the bogus lookup helper and
      adding the missing endpoint sanity checks while keeping the interrupt-
      descriptor assumption for now.
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9a70de92
    • Ido Schimmel's avatar
      vxlan: Ensure FDB dump is performed under RCU · db8e1fb8
      Ido Schimmel authored
      [ Upstream commit b5141915 ]
      
      The commit cited below removed the RCU read-side critical section from
      rtnl_fdb_dump() which means that the ndo_fdb_dump() callback is invoked
      without RCU protection.
      
      This results in the following warning [1] in the VXLAN driver, which
      relied on the callback being invoked from an RCU read-side critical
      section.
      
      Fix this by calling rcu_read_lock() in the VXLAN driver, as already done
      in the bridge driver.
      
      [1]
      WARNING: suspicious RCU usage
      5.8.0-rc4-custom-01521-g481007553ce6 #29 Not tainted
      -----------------------------
      drivers/net/vxlan.c:1379 RCU-list traversed in non-reader section!!
      
      other info that might help us debug this:
      
      rcu_scheduler_active = 2, debug_locks = 1
      1 lock held by bridge/166:
       #0: ffffffff85a27850 (rtnl_mutex){+.+.}-{3:3}, at: netlink_dump+0xea/0x1090
      
      stack backtrace:
      CPU: 1 PID: 166 Comm: bridge Not tainted 5.8.0-rc4-custom-01521-g481007553ce6 #29
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-2.fc32 04/01/2014
      Call Trace:
       dump_stack+0x100/0x184
       lockdep_rcu_suspicious+0x153/0x15d
       vxlan_fdb_dump+0x51e/0x6d0
       rtnl_fdb_dump+0x4dc/0xad0
       netlink_dump+0x540/0x1090
       __netlink_dump_start+0x695/0x950
       rtnetlink_rcv_msg+0x802/0xbd0
       netlink_rcv_skb+0x17a/0x480
       rtnetlink_rcv+0x22/0x30
       netlink_unicast+0x5ae/0x890
       netlink_sendmsg+0x98a/0xf40
       __sys_sendto+0x279/0x3b0
       __x64_sys_sendto+0xe6/0x1a0
       do_syscall_64+0x54/0xa0
       entry_SYSCALL_64_after_hwframe+0x44/0xa9
      RIP: 0033:0x7fe14fa2ade0
      Code: Bad RIP value.
      RSP: 002b:00007fff75bb5b88 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
      RAX: ffffffffffffffda RBX: 00005614b1ba0020 RCX: 00007fe14fa2ade0
      RDX: 000000000000011c RSI: 00007fff75bb5b90 RDI: 0000000000000003
      RBP: 00007fff75bb5b90 R08: 0000000000000000 R09: 0000000000000000
      R10: 0000000000000000 R11: 0000000000000246 R12: 00005614b1b89160
      R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
      
      Fixes: 5e6d2435 ("bridge: netlink dump interface at par with brctl")
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Reviewed-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      db8e1fb8
    • Landen Chao's avatar
      net: ethernet: mtk_eth_soc: fix MTU warnings · 2ab3d262
      Landen Chao authored
      [ Upstream commit 555a8933 ]
      
      in recent kernel versions there are warnings about incorrect MTU size
      like these:
      
      eth0: mtu greater than device maximum
      mtk_soc_eth 1b100000.ethernet eth0: error -22 setting MTU to include DSA overhead
      
      Fixes: bfcb8132 ("net: dsa: configure the MTU for switch ports")
      Fixes: 72579e14 ("net: dsa: don't fail to probe if we couldn't set the MTU")
      Fixes: 7a4c53be ("net: report invalid mtu value via netlink extack")
      Signed-off-by: default avatarLanden Chao <landen.chao@mediatek.com>
      Signed-off-by: default avatarFrank Wunderlich <frank-w@public-files.de>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2ab3d262
    • Cong Wang's avatar
      ipv6: fix memory leaks on IPV6_ADDRFORM path · 9c8652db
      Cong Wang authored
      [ Upstream commit 8c0de6e9 ]
      
      IPV6_ADDRFORM causes resource leaks when converting an IPv6 socket
      to IPv4, particularly struct ipv6_ac_socklist. Similar to
      struct ipv6_mc_socklist, we should just close it on this path.
      
      This bug can be easily reproduced with the following C program:
      
        #include <stdio.h>
        #include <string.h>
        #include <sys/types.h>
        #include <sys/socket.h>
        #include <arpa/inet.h>
      
        int main()
        {
          int s, value;
          struct sockaddr_in6 addr;
          struct ipv6_mreq m6;
      
          s = socket(AF_INET6, SOCK_DGRAM, 0);
          addr.sin6_family = AF_INET6;
          addr.sin6_port = htons(5000);
          inet_pton(AF_INET6, "::ffff:192.168.122.194", &addr.sin6_addr);
          connect(s, (struct sockaddr *)&addr, sizeof(addr));
      
          inet_pton(AF_INET6, "fe80::AAAA", &m6.ipv6mr_multiaddr);
          m6.ipv6mr_interface = 5;
          setsockopt(s, SOL_IPV6, IPV6_JOIN_ANYCAST, &m6, sizeof(m6));
      
          value = AF_INET;
          setsockopt(s, SOL_IPV6, IPV6_ADDRFORM, &value, sizeof(value));
      
          close(s);
          return 0;
        }
      
      Reported-by: ch3332xr@gmail.com
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Signed-off-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9c8652db
    • Ido Schimmel's avatar
      ipv4: Silence suspicious RCU usage warning · eab3600b
      Ido Schimmel authored
      [ Upstream commit 83f35228 ]
      
      fib_trie_unmerge() is called with RTNL held, but not from an RCU
      read-side critical section. This leads to the following warning [1] when
      the FIB alias list in a leaf is traversed with
      hlist_for_each_entry_rcu().
      
      Since the function is always called with RTNL held and since
      modification of the list is protected by RTNL, simply use
      hlist_for_each_entry() and silence the warning.
      
      [1]
      WARNING: suspicious RCU usage
      5.8.0-rc4-custom-01520-gc1f937f3f83b #30 Not tainted
      -----------------------------
      net/ipv4/fib_trie.c:1867 RCU-list traversed in non-reader section!!
      
      other info that might help us debug this:
      
      rcu_scheduler_active = 2, debug_locks = 1
      1 lock held by ip/164:
       #0: ffffffff85a27850 (rtnl_mutex){+.+.}-{3:3}, at: rtnetlink_rcv_msg+0x49a/0xbd0
      
      stack backtrace:
      CPU: 0 PID: 164 Comm: ip Not tainted 5.8.0-rc4-custom-01520-gc1f937f3f83b #30
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-2.fc32 04/01/2014
      Call Trace:
       dump_stack+0x100/0x184
       lockdep_rcu_suspicious+0x153/0x15d
       fib_trie_unmerge+0x608/0xdb0
       fib_unmerge+0x44/0x360
       fib4_rule_configure+0xc8/0xad0
       fib_nl_newrule+0x37a/0x1dd0
       rtnetlink_rcv_msg+0x4f7/0xbd0
       netlink_rcv_skb+0x17a/0x480
       rtnetlink_rcv+0x22/0x30
       netlink_unicast+0x5ae/0x890
       netlink_sendmsg+0x98a/0xf40
       ____sys_sendmsg+0x879/0xa00
       ___sys_sendmsg+0x122/0x190
       __sys_sendmsg+0x103/0x1d0
       __x64_sys_sendmsg+0x7d/0xb0
       do_syscall_64+0x54/0xa0
       entry_SYSCALL_64_after_hwframe+0x44/0xa9
      RIP: 0033:0x7fc80a234e97
      Code: Bad RIP value.
      RSP: 002b:00007ffef8b66798 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
      RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fc80a234e97
      RDX: 0000000000000000 RSI: 00007ffef8b66800 RDI: 0000000000000003
      RBP: 000000005f141b1c R08: 0000000000000001 R09: 0000000000000000
      R10: 00007fc80a2a8ac0 R11: 0000000000000246 R12: 0000000000000001
      R13: 0000000000000000 R14: 00007ffef8b67008 R15: 0000556fccb10020
      
      Fixes: 0ddcf43d ("ipv4: FIB Local/MAIN table collapse")
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Reviewed-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      eab3600b
    • Frank van der Linden's avatar
      xattr: break delegations in {set,remove}xattr · fabe9d6c
      Frank van der Linden authored
      commit 08b5d501 upstream.
      
      set/removexattr on an exported filesystem should break NFS delegations.
      This is true in general, but also for the upcoming support for
      RFC 8726 (NFSv4 extended attribute support). Make sure that they do.
      
      Additionally, they need to grow a _locked variant, since callers might
      call this with i_rwsem held (like the NFS server code).
      
      Cc: stable@vger.kernel.org # v4.9+
      Cc: linux-fsdevel@vger.kernel.org
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarFrank van der Linden <fllinden@amazon.com>
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fabe9d6c
    • Dexuan Cui's avatar
      Drivers: hv: vmbus: Ignore CHANNELMSG_TL_CONNECT_RESULT(23) · 0a3172f9
      Dexuan Cui authored
      [ Upstream commit ddc9d357 ]
      
      When a Linux hv_sock app tries to connect to a Service GUID on which no
      host app is listening, a recent host (RS3+) sends a
      CHANNELMSG_TL_CONNECT_RESULT (23) message to Linux and this triggers such
      a warning:
      
      unknown msgtype=23
      WARNING: CPU: 2 PID: 0 at drivers/hv/vmbus_drv.c:1031 vmbus_on_msg_dpc
      
      Actually Linux can safely ignore the message because the Linux app's
      connect() will time out in 2 seconds: see VSOCK_DEFAULT_CONNECT_TIMEOUT
      and vsock_stream_connect(). We don't bother to make use of the message
      because: 1) it's only supported on recent hosts; 2) a non-trivial effort
      is required to use the message in Linux, but the benefit is small.
      
      So, let's not see the warning by silently ignoring the message.
      Signed-off-by: default avatarDexuan Cui <decui@microsoft.com>
      Reviewed-by: default avatarMichael Kelley <mikelley@microsoft.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0a3172f9
    • Philippe Duplessis-Guindon's avatar
      tools lib traceevent: Fix memory leak in process_dynamic_array_len · b5650e4f
      Philippe Duplessis-Guindon authored
      [ Upstream commit e24c6447 ]
      
      I compiled with AddressSanitizer and I had these memory leaks while I
      was using the tep_parse_format function:
      
          Direct leak of 28 byte(s) in 4 object(s) allocated from:
              #0 0x7fb07db49ffe in __interceptor_realloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10dffe)
              #1 0x7fb07a724228 in extend_token /home/pduplessis/repo/linux/tools/lib/traceevent/event-parse.c:985
              #2 0x7fb07a724c21 in __read_token /home/pduplessis/repo/linux/tools/lib/traceevent/event-parse.c:1140
              #3 0x7fb07a724f78 in read_token /home/pduplessis/repo/linux/tools/lib/traceevent/event-parse.c:1206
              #4 0x7fb07a725191 in __read_expect_type /home/pduplessis/repo/linux/tools/lib/traceevent/event-parse.c:1291
              #5 0x7fb07a7251df in read_expect_type /home/pduplessis/repo/linux/tools/lib/traceevent/event-parse.c:1299
              #6 0x7fb07a72e6c8 in process_dynamic_array_len /home/pduplessis/repo/linux/tools/lib/traceevent/event-parse.c:2849
              #7 0x7fb07a7304b8 in process_function /home/pduplessis/repo/linux/tools/lib/traceevent/event-parse.c:3161
              #8 0x7fb07a730900 in process_arg_token /home/pduplessis/repo/linux/tools/lib/traceevent/event-parse.c:3207
              #9 0x7fb07a727c0b in process_arg /home/pduplessis/repo/linux/tools/lib/traceevent/event-parse.c:1786
              #10 0x7fb07a731080 in event_read_print_args /home/pduplessis/repo/linux/tools/lib/traceevent/event-parse.c:3285
              #11 0x7fb07a731722 in event_read_print /home/pduplessis/repo/linux/tools/lib/traceevent/event-parse.c:3369
              #12 0x7fb07a740054 in __tep_parse_format /home/pduplessis/repo/linux/tools/lib/traceevent/event-parse.c:6335
              #13 0x7fb07a74047a in __parse_event /home/pduplessis/repo/linux/tools/lib/traceevent/event-parse.c:6389
              #14 0x7fb07a740536 in tep_parse_format /home/pduplessis/repo/linux/tools/lib/traceevent/event-parse.c:6431
              #15 0x7fb07a785acf in parse_event ../../../src/fs-src/fs.c:251
              #16 0x7fb07a785ccd in parse_systems ../../../src/fs-src/fs.c:284
              #17 0x7fb07a786fb3 in read_metadata ../../../src/fs-src/fs.c:593
              #18 0x7fb07a78760e in ftrace_fs_source_init ../../../src/fs-src/fs.c:727
              #19 0x7fb07d90c19c in add_component_with_init_method_data ../../../../src/lib/graph/graph.c:1048
              #20 0x7fb07d90c87b in add_source_component_with_initialize_method_data ../../../../src/lib/graph/graph.c:1127
              #21 0x7fb07d90c92a in bt_graph_add_source_component ../../../../src/lib/graph/graph.c:1152
              #22 0x55db11aa632e in cmd_run_ctx_create_components_from_config_components ../../../src/cli/babeltrace2.c:2252
              #23 0x55db11aa6fda in cmd_run_ctx_create_components ../../../src/cli/babeltrace2.c:2347
              #24 0x55db11aa780c in cmd_run ../../../src/cli/babeltrace2.c:2461
              #25 0x55db11aa8a7d in main ../../../src/cli/babeltrace2.c:2673
              #26 0x7fb07d5460b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
      
      The token variable in the process_dynamic_array_len function is
      allocated in the read_expect_type function, but is not freed before
      calling the read_token function.
      
      Free the token variable before calling read_token in order to plug the
      leak.
      Signed-off-by: default avatarPhilippe Duplessis-Guindon <pduplessis@efficios.com>
      Reviewed-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      Link: https://lore.kernel.org/linux-trace-devel/20200730150236.5392-1-pduplessis@efficios.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b5650e4f
    • Xin Xiong's avatar
      atm: fix atm_dev refcnt leaks in atmtcp_remove_persistent · fea1298d
      Xin Xiong authored
      [ Upstream commit 51875dad ]
      
      atmtcp_remove_persistent() invokes atm_dev_lookup(), which returns a
      reference of atm_dev with increased refcount or NULL if fails.
      
      The refcount leaks issues occur in two error handling paths. If
      dev_data->persist is zero or PRIV(dev)->vcc isn't NULL, the function
      returns 0 without decreasing the refcount kept by a local variable,
      resulting in refcount leaks.
      
      Fix the issue by adding atm_dev_put() before returning 0 both when
      dev_data->persist is zero or PRIV(dev)->vcc isn't NULL.
      Signed-off-by: default avatarXin Xiong <xiongx18@fudan.edu.cn>
      Signed-off-by: default avatarXiyu Yang <xiyuyang19@fudan.edu.cn>
      Signed-off-by: default avatarXin Tan <tanxin.ctf@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      fea1298d
    • Francesco Ruggeri's avatar
      igb: reinit_locked() should be called with rtnl_lock · 0adedbf7
      Francesco Ruggeri authored
      [ Upstream commit 024a8168 ]
      
      We observed two panics involving races with igb_reset_task.
      The first panic is caused by this race condition:
      
      	kworker			reboot -f
      
      	igb_reset_task
      	igb_reinit_locked
      	igb_down
      	napi_synchronize
      				__igb_shutdown
      				igb_clear_interrupt_scheme
      				igb_free_q_vectors
      				igb_free_q_vector
      				adapter->q_vector[v_idx] = NULL;
      	napi_disable
      	Panics trying to access
      	adapter->q_vector[v_idx].napi_state
      
      The second panic (a divide error) is caused by this race:
      
      kworker		reboot -f	tx packet
      
      igb_reset_task
      		__igb_shutdown
      		rtnl_lock()
      		...
      		igb_clear_interrupt_scheme
      		igb_free_q_vectors
      		adapter->num_tx_queues = 0
      		...
      		rtnl_unlock()
      rtnl_lock()
      igb_reinit_locked
      igb_down
      igb_up
      netif_tx_start_all_queues
      				dev_hard_start_xmit
      				igb_xmit_frame
      				igb_tx_queue_mapping
      				Panics on
      				r_idx % adapter->num_tx_queues
      
      This commit applies to igb_reset_task the same changes that
      were applied to ixgbe in commit 2f90b865 ("ixgbe: this patch
      adds support for DCB to the kernel and ixgbe driver"),
      commit 8f4c5c9f ("ixgbe: reinit_locked() should be called with
      rtnl_lock") and commit 88adce4e ("ixgbe: fix possible race in
      reset subtask").
      Signed-off-by: default avatarFrancesco Ruggeri <fruggeri@arista.com>
      Tested-by: default avatarAaron Brown <aaron.f.brown@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0adedbf7