1. 14 7月, 2020 1 次提交
  2. 14 6月, 2020 2 次提交
  3. 13 6月, 2020 4 次提交
  4. 12 6月, 2020 15 次提交
  5. 11 6月, 2020 4 次提交
  6. 10 6月, 2020 8 次提交
    • W
      dccp: Fix possible memleak in dccp_init and dccp_fini · c96b6acc
      Wang Hai 提交于
      There are some memory leaks in dccp_init() and dccp_fini().
      
      In dccp_fini() and the error handling path in dccp_init(), free lhash2
      is missing. Add inet_hashinfo2_free_mod() to do it.
      
      If inet_hashinfo2_init_mod() failed in dccp_init(),
      percpu_counter_destroy() should be called to destroy dccp_orphan_count.
      It need to goto out_free_percpu when inet_hashinfo2_init_mod() failed.
      
      Fixes: c92c81df ("net: dccp: fix kernel crash on module load")
      Reported-by: NHulk Robot <hulkci@huawei.com>
      Signed-off-by: NWang Hai <wanghai38@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c96b6acc
    • V
      net: sched: export __netdev_watchdog_up() · 1a3db27a
      Valentin Longchamp 提交于
      Since the quiesce/activate rework, __netdev_watchdog_up() is directly
      called in the ucc_geth driver.
      
      Unfortunately, this function is not available for modules and thus
      ucc_geth cannot be built as a module anymore. Fix it by exporting
      __netdev_watchdog_up().
      
      Since the commit introducing the regression was backported to stable
      branches, this one should ideally be as well.
      
      Fixes: 79dde73c ("net/ethernet/freescale: rework quiesce/activate for ucc_geth")
      Signed-off-by: NValentin Longchamp <valentin@longchamp.me>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1a3db27a
    • C
      net: change addr_list_lock back to static key · 845e0ebb
      Cong Wang 提交于
      The dynamic key update for addr_list_lock still causes troubles,
      for example the following race condition still exists:
      
      CPU 0:				CPU 1:
      (RCU read lock)			(RTNL lock)
      dev_mc_seq_show()		netdev_update_lockdep_key()
      				  -> lockdep_unregister_key()
       -> netif_addr_lock_bh()
      
      because lockdep doesn't provide an API to update it atomically.
      Therefore, we have to move it back to static keys and use subclass
      for nest locking like before.
      
      In commit 1a33e10e ("net: partially revert dynamic lockdep key
      changes"), I already reverted most parts of commit ab92d68f
      ("net: core: add generic lockdep keys").
      
      This patch reverts the rest and also part of commit f3b0a18b
      ("net: remove unnecessary variables and callback"). After this
      patch, addr_list_lock changes back to using static keys and
      subclasses to satisfy lockdep. Thanks to dev->lower_level, we do
      not have to change back to ->ndo_get_lock_subclass().
      
      And hopefully this reduces some syzbot lockdep noises too.
      
      Reported-by: syzbot+f3a0e80c34b3fc28ac5e@syzkaller.appspotmail.com
      Cc: Taehee Yoo <ap420073@gmail.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Signed-off-by: NCong Wang <xiyou.wangcong@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      845e0ebb
    • J
      bpf, sockhash: Synchronize delete from bucket list on map free · 75e68e5b
      Jakub Sitnicki 提交于
      We can end up modifying the sockhash bucket list from two CPUs when a
      sockhash is being destroyed (sock_hash_free) on one CPU, while a socket
      that is in the sockhash is unlinking itself from it on another CPU
      it (sock_hash_delete_from_link).
      
      This results in accessing a list element that is in an undefined state as
      reported by KASAN:
      
      | ==================================================================
      | BUG: KASAN: wild-memory-access in sock_hash_free+0x13c/0x280
      | Write of size 8 at addr dead000000000122 by task kworker/2:1/95
      |
      | CPU: 2 PID: 95 Comm: kworker/2:1 Not tainted 5.7.0-rc7-02961-ge22c35ab0038-dirty #691
      | Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS ?-20190727_073836-buildvm-ppc64le-16.ppc.fedoraproject.org-3.fc31 04/01/2014
      | Workqueue: events bpf_map_free_deferred
      | Call Trace:
      |  dump_stack+0x97/0xe0
      |  ? sock_hash_free+0x13c/0x280
      |  __kasan_report.cold+0x5/0x40
      |  ? mark_lock+0xbc1/0xc00
      |  ? sock_hash_free+0x13c/0x280
      |  kasan_report+0x38/0x50
      |  ? sock_hash_free+0x152/0x280
      |  sock_hash_free+0x13c/0x280
      |  bpf_map_free_deferred+0xb2/0xd0
      |  ? bpf_map_charge_finish+0x50/0x50
      |  ? rcu_read_lock_sched_held+0x81/0xb0
      |  ? rcu_read_lock_bh_held+0x90/0x90
      |  process_one_work+0x59a/0xac0
      |  ? lock_release+0x3b0/0x3b0
      |  ? pwq_dec_nr_in_flight+0x110/0x110
      |  ? rwlock_bug.part.0+0x60/0x60
      |  worker_thread+0x7a/0x680
      |  ? _raw_spin_unlock_irqrestore+0x4c/0x60
      |  kthread+0x1cc/0x220
      |  ? process_one_work+0xac0/0xac0
      |  ? kthread_create_on_node+0xa0/0xa0
      |  ret_from_fork+0x24/0x30
      | ==================================================================
      
      Fix it by reintroducing spin-lock protected critical section around the
      code that removes the elements from the bucket on sockhash free.
      
      To do that we also need to defer processing of removed elements, until out
      of atomic context so that we can unlink the socket from the map when
      holding the sock lock.
      
      Fixes: 90db6d77 ("bpf, sockmap: Remove bucket->lock from sock_{hash|map}_free")
      Reported-by: NEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: NJakub Sitnicki <jakub@cloudflare.com>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      Acked-by: NJohn Fastabend <john.fastabend@gmail.com>
      Link: https://lore.kernel.org/bpf/20200607205229.2389672-3-jakub@cloudflare.com
      75e68e5b
    • J
      bpf, sockhash: Fix memory leak when unlinking sockets in sock_hash_free · 33a7c831
      Jakub Sitnicki 提交于
      When sockhash gets destroyed while sockets are still linked to it, we will
      walk the bucket lists and delete the links. However, we are not freeing the
      list elements after processing them, leaking the memory.
      
      The leak can be triggered by close()'ing a sockhash map when it still
      contains sockets, and observed with kmemleak:
      
        unreferenced object 0xffff888116e86f00 (size 64):
          comm "race_sock_unlin", pid 223, jiffies 4294731063 (age 217.404s)
          hex dump (first 32 bytes):
            00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
            81 de e8 41 00 00 00 00 c0 69 2f 15 81 88 ff ff  ...A.....i/.....
          backtrace:
            [<00000000dd089ebb>] sock_hash_update_common+0x4ca/0x760
            [<00000000b8219bd5>] sock_hash_update_elem+0x1d2/0x200
            [<000000005e2c23de>] __do_sys_bpf+0x2046/0x2990
            [<00000000d0084618>] do_syscall_64+0xad/0x9a0
            [<000000000d96f263>] entry_SYSCALL_64_after_hwframe+0x49/0xb3
      
      Fix it by freeing the list element when we're done with it.
      
      Fixes: 604326b4 ("bpf, sockmap: convert to generic sk_msg interface")
      Signed-off-by: NJakub Sitnicki <jakub@cloudflare.com>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      Acked-by: NJohn Fastabend <john.fastabend@gmail.com>
      Link: https://lore.kernel.org/bpf/20200607205229.2389672-2-jakub@cloudflare.com
      33a7c831
    • D
      bpf/sockmap: Fix kernel panic at __tcp_bpf_recvmsg · 487082fb
      dihu 提交于
      When user application calls read() with MSG_PEEK flag to read data
      of bpf sockmap socket, kernel panic happens at
      __tcp_bpf_recvmsg+0x12c/0x350. sk_msg is not removed from ingress_msg
      queue after read out under MSG_PEEK flag is set. Because it's not
      judged whether sk_msg is the last msg of ingress_msg queue, the next
      sk_msg may be the head of ingress_msg queue, whose memory address of
      sg page is invalid. So it's necessary to add check codes to prevent
      this problem.
      
      [20759.125457] BUG: kernel NULL pointer dereference, address:
      0000000000000008
      [20759.132118] CPU: 53 PID: 51378 Comm: envoy Tainted: G            E
      5.4.32 #1
      [20759.140890] Hardware name: Inspur SA5212M4/YZMB-00370-109, BIOS
      4.1.12 06/18/2017
      [20759.149734] RIP: 0010:copy_page_to_iter+0xad/0x300
      [20759.270877] __tcp_bpf_recvmsg+0x12c/0x350
      [20759.276099] tcp_bpf_recvmsg+0x113/0x370
      [20759.281137] inet_recvmsg+0x55/0xc0
      [20759.285734] __sys_recvfrom+0xc8/0x130
      [20759.290566] ? __audit_syscall_entry+0x103/0x130
      [20759.296227] ? syscall_trace_enter+0x1d2/0x2d0
      [20759.301700] ? __audit_syscall_exit+0x1e4/0x290
      [20759.307235] __x64_sys_recvfrom+0x24/0x30
      [20759.312226] do_syscall_64+0x55/0x1b0
      [20759.316852] entry_SYSCALL_64_after_hwframe+0x44/0xa9
      Signed-off-by: Ndihu <anny.hu@linux.alibaba.com>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      Acked-by: NJohn Fastabend <john.fastabend@gmail.com>
      Acked-by: NJakub Sitnicki <jakub@cloudflare.com>
      Link: https://lore.kernel.org/bpf/20200605084625.9783-1-anny.hu@linux.alibaba.com
      487082fb
    • M
      mmap locking API: convert mmap_sem API comments · 3e4e28c5
      Michel Lespinasse 提交于
      Convert comments that reference old mmap_sem APIs to reference
      corresponding new mmap locking APIs instead.
      Signed-off-by: NMichel Lespinasse <walken@google.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Reviewed-by: NVlastimil Babka <vbabka@suse.cz>
      Reviewed-by: NDavidlohr Bueso <dbueso@suse.de>
      Reviewed-by: NDaniel Jordan <daniel.m.jordan@oracle.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Jason Gunthorpe <jgg@ziepe.ca>
      Cc: Jerome Glisse <jglisse@redhat.com>
      Cc: John Hubbard <jhubbard@nvidia.com>
      Cc: Laurent Dufour <ldufour@linux.ibm.com>
      Cc: Liam Howlett <Liam.Howlett@oracle.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ying Han <yinghan@google.com>
      Link: http://lkml.kernel.org/r/20200520052908.204642-12-walken@google.comSigned-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      3e4e28c5
    • M
      mmap locking API: use coccinelle to convert mmap_sem rwsem call sites · d8ed45c5
      Michel Lespinasse 提交于
      This change converts the existing mmap_sem rwsem calls to use the new mmap
      locking API instead.
      
      The change is generated using coccinelle with the following rule:
      
      // spatch --sp-file mmap_lock_api.cocci --in-place --include-headers --dir .
      
      @@
      expression mm;
      @@
      (
      -init_rwsem
      +mmap_init_lock
      |
      -down_write
      +mmap_write_lock
      |
      -down_write_killable
      +mmap_write_lock_killable
      |
      -down_write_trylock
      +mmap_write_trylock
      |
      -up_write
      +mmap_write_unlock
      |
      -downgrade_write
      +mmap_write_downgrade
      |
      -down_read
      +mmap_read_lock
      |
      -down_read_killable
      +mmap_read_lock_killable
      |
      -down_read_trylock
      +mmap_read_trylock
      |
      -up_read
      +mmap_read_unlock
      )
      -(&mm->mmap_sem)
      +(mm)
      Signed-off-by: NMichel Lespinasse <walken@google.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Reviewed-by: NDaniel Jordan <daniel.m.jordan@oracle.com>
      Reviewed-by: NLaurent Dufour <ldufour@linux.ibm.com>
      Reviewed-by: NVlastimil Babka <vbabka@suse.cz>
      Cc: Davidlohr Bueso <dbueso@suse.de>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Jason Gunthorpe <jgg@ziepe.ca>
      Cc: Jerome Glisse <jglisse@redhat.com>
      Cc: John Hubbard <jhubbard@nvidia.com>
      Cc: Liam Howlett <Liam.Howlett@oracle.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ying Han <yinghan@google.com>
      Link: http://lkml.kernel.org/r/20200520052908.204642-5-walken@google.comSigned-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      d8ed45c5
  7. 09 6月, 2020 2 次提交
  8. 08 6月, 2020 3 次提交
  9. 06 6月, 2020 1 次提交