1. 04 12月, 2020 10 次提交
  2. 26 10月, 2020 2 次提交
  3. 25 10月, 2020 2 次提交
    • H
      i2c: core: Restore acpi_walk_dep_device_list() getting called after registering the ACPI i2c devs · 8058d699
      Hans de Goede 提交于
      Commit 21653a41 ("i2c: core: Call i2c_acpi_install_space_handler()
      before i2c_acpi_register_devices()")'s intention was to only move the
      acpi_install_address_space_handler() call to the point before where
      the ACPI declared i2c-children of the adapter where instantiated by
      i2c_acpi_register_devices().
      
      But i2c_acpi_install_space_handler() had a call to
      acpi_walk_dep_device_list() hidden (that is I missed it) at the end
      of it, so as an unwanted side-effect now acpi_walk_dep_device_list()
      was also being called before i2c_acpi_register_devices().
      
      Move the acpi_walk_dep_device_list() call to the end of
      i2c_acpi_register_devices(), so that it is once again called *after*
      the i2c_client-s hanging of the adapter have been created.
      
      This fixes the Microsoft Surface Go 2 hanging at boot.
      
      Fixes: 21653a41 ("i2c: core: Call i2c_acpi_install_space_handler() before i2c_acpi_register_devices()")
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=209627Reported-by: NRainer Finke <rainer@finke.cc>
      Reported-by: NKieran Bingham <kieran.bingham@ideasonboard.com>
      Suggested-by: NMaximilian Luz <luzmaximilian@gmail.com>
      Tested-by: NKieran Bingham <kieran.bingham@ideasonboard.com>
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NWolfram Sang <wsa@kernel.org>
      8058d699
    • G
      random32: make prandom_u32() output unpredictable · c51f8f88
      George Spelvin 提交于
      Non-cryptographic PRNGs may have great statistical properties, but
      are usually trivially predictable to someone who knows the algorithm,
      given a small sample of their output.  An LFSR like prandom_u32() is
      particularly simple, even if the sample is widely scattered bits.
      
      It turns out the network stack uses prandom_u32() for some things like
      random port numbers which it would prefer are *not* trivially predictable.
      Predictability led to a practical DNS spoofing attack.  Oops.
      
      This patch replaces the LFSR with a homebrew cryptographic PRNG based
      on the SipHash round function, which is in turn seeded with 128 bits
      of strong random key.  (The authors of SipHash have *not* been consulted
      about this abuse of their algorithm.)  Speed is prioritized over security;
      attacks are rare, while performance is always wanted.
      
      Replacing all callers of prandom_u32() is the quick fix.
      Whether to reinstate a weaker PRNG for uses which can tolerate it
      is an open question.
      
      Commit f227e3ec ("random32: update the net random state on interrupt
      and activity") was an earlier attempt at a solution.  This patch replaces
      it.
      Reported-by: NAmit Klein <aksecurity@gmail.com>
      Cc: Willy Tarreau <w@1wt.eu>
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: "Jason A. Donenfeld" <Jason@zx2c4.com>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: tytso@mit.edu
      Cc: Florian Westphal <fw@strlen.de>
      Cc: Marc Plumb <lkml.mplumb@gmail.com>
      Fixes: f227e3ec ("random32: update the net random state on interrupt and activity")
      Signed-off-by: NGeorge Spelvin <lkml@sdf.org>
      Link: https://lore.kernel.org/netdev/20200808152628.GA27941@SDF.ORG/
      [ willy: partial reversal of f227e3ec; moved SIPROUND definitions
        to prandom.h for later use; merged George's prandom_seed() proposal;
        inlined siprand_u32(); replaced the net_rand_state[] array with 4
        members to fix a build issue; cosmetic cleanups to make checkpatch
        happy; fixed RANDOM32_SELFTEST build ]
      Signed-off-by: NWilly Tarreau <w@1wt.eu>
      c51f8f88
  4. 24 10月, 2020 2 次提交
  5. 23 10月, 2020 14 次提交
  6. 22 10月, 2020 10 次提交
    • C
      nvmet: don't use BLK_MQ_REQ_NOWAIT for passthru · 150dfb6c
      Chaitanya Kulkarni 提交于
      By default, we set the passthru request allocation flag such that it
      returns the error in the following code path and we fail the I/O when
      BLK_MQ_REQ_NOWAIT is used for request allocation :-
      
      nvme_alloc_request()
       blk_mq_alloc_request()
        blk_mq_queue_enter()
         if (flag & BLK_MQ_REQ_NOWAIT)
              return -EBUSY; <-- return if busy.
      
      On some controllers using BLK_MQ_REQ_NOWAIT ends up in I/O error where
      the controller is perfectly healthy and not in a degraded state.
      
      Block layer request allocation does allow us to wait instead of
      immediately returning the error when we BLK_MQ_REQ_NOWAIT flag is not
      used. This has shown to fix the I/O error problem reported under
      heavy random write workload.
      
      Remove the BLK_MQ_REQ_NOWAIT parameter for passthru request allocation
      which resolves this issue.
      Signed-off-by: NChaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
      Reviewed-by: NLogan Gunthorpe <logang@deltatee.com>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      150dfb6c
    • L
      nvmet: cleanup nvmet_passthru_map_sg() · 5e063101
      Logan Gunthorpe 提交于
      Clean up some confusing elements of nvmet_passthru_map_sg() by returning
      early if the request is greater than the maximum bio size. This allows
      us to drop the sg_cnt variable.
      
      This should not result in any functional change but makes the code
      clearer and more understandable. The original code allocated a truncated
      bio then would return EINVAL when bio_add_pc_page() filled that bio. The
      new code just returns EINVAL early if this would happen.
      
      Fixes: c1fef73f ("nvmet: add passthru code to process commands")
      Signed-off-by: NLogan Gunthorpe <logang@deltatee.com>
      Suggested-by: NDouglas Gilbert <dgilbert@interlog.com>
      Reviewed-by: NSagi Grimberg <sagi@grimberg.me>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      5e063101
    • L
      nvmet: limit passthru MTDS by BIO_MAX_PAGES · df06047d
      Logan Gunthorpe 提交于
      nvmet_passthru_map_sg() only supports mapping a single BIO, not a chain
      so the effective maximum transfer should also be limitted by
      BIO_MAX_PAGES (presently this works out to 1MB).
      
      For PCI passthru devices the max_sectors would typically be more
      limitting than BIO_MAX_PAGES, but this may not be true for all passthru
      devices.
      
      Fixes: c1fef73f ("nvmet: add passthru code to process commands")
      Suggested-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NLogan Gunthorpe <logang@deltatee.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Sagi Grimberg <sagi@grimberg.me>
      Cc: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      df06047d
    • Z
      nvmet: fix uninitialized work for zero kato · 85bd23f3
      zhenwei pi 提交于
      When connecting a controller with a zero kato value using the following
      command line
      
         nvme connect -t tcp -n NQN -a ADDR -s PORT --keep-alive-tmo=0
      
      the warning below can be reproduced:
      
      WARNING: CPU: 1 PID: 241 at kernel/workqueue.c:1627 __queue_delayed_work+0x6d/0x90
      with trace:
        mod_delayed_work_on+0x59/0x90
        nvmet_update_cc+0xee/0x100 [nvmet]
        nvmet_execute_prop_set+0x72/0x80 [nvmet]
        nvmet_tcp_try_recv_pdu+0x2f7/0x770 [nvmet_tcp]
        nvmet_tcp_io_work+0x63f/0xb2d [nvmet_tcp]
        ...
      
      This is caused by queuing up an uninitialized work.  Althrough the
      keep-alive timer is disabled during allocating the controller (fixed in
      0d3b6a8d), ka_work still has a chance to run (called by
      nvmet_start_ctrl).
      
      Fixes: 0d3b6a8d ("nvmet: Disable keep-alive timer when kato is cleared to 0h")
      Signed-off-by: Nzhenwei pi <pizhenwei@bytedance.com>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      85bd23f3
    • K
      nvme-pci: disable Write Zeroes on Sandisk Skyhawk · 02ca079c
      Kai-Heng Feng 提交于
      Like commit 5611ec2b ("nvme-pci: prevent SK hynix PC400 from using
      Write Zeroes command"), Sandisk Skyhawk has the same issue:
      [ 6305.633887] blk_update_request: operation not supported error, dev nvme0n1, sector 340812032 op 0x9:(WRITE_ZEROES) flags 0x0 phys_seg 0 prio class 0
      
      So also disable Write Zeroes command on Sandisk Skyhawk.
      
      BugLink: https://bugs.launchpad.net/bugs/1899503Signed-off-by: NKai-Heng Feng <kai.heng.feng@canonical.com>
      Reviewed-by: NChaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      02ca079c
    • K
      nvme: use queuedata for nvme_req_qid · 643c476d
      Keith Busch 提交于
      The request's rq_disk isn't set for passthrough IO commands, so tracing
      uses qid 0 for these which incorrectly decodes as an admin command. Use
      the request_queue's queuedata instead since that value is always set for
      the IO queues, and never set for the admin queue.
      Signed-off-by: NKeith Busch <kbusch@kernel.org>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      643c476d
    • C
      nvme-rdma: fix crash due to incorrect cqe · a87da50f
      Chao Leng 提交于
      A crash happened due to injecting error test.
      When a CQE has incorrect command id due do an error injection, the host
      may find a request which is already freed.  Dereferencing req->mr->rkey
      causes a crash in nvme_rdma_process_nvme_rsp because the mr is already
      freed.
      
      Add a check for the mr to fix it.
      Signed-off-by: NChao Leng <lengchao@huawei.com>
      Reviewed-by: NSagi Grimberg <sagi@grimberg.me>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      a87da50f
    • C
      nvme-rdma: fix crash when connect rejected · 43efdb8e
      Chao Leng 提交于
      A crash can happened when a connect is rejected.   The host establishes
      the connection after received ConnectReply, and then continues to send
      the fabrics Connect command.  If the controller does not receive the
      ReadyToUse capsule, host may receive a ConnectReject reply.
      
      Call nvme_rdma_destroy_queue_ib after the host received the
      RDMA_CM_EVENT_REJECTED event.  Then when the fabrics Connect command
      times out, nvme_rdma_timeout calls nvme_rdma_complete_rq to fail the
      request.  A crash happenes due to use after free in
      nvme_rdma_complete_rq.
      
      nvme_rdma_destroy_queue_ib is redundant when handling the
      RDMA_CM_EVENT_REJECTED event as nvme_rdma_destroy_queue_ib is already
      called in connection failure handler.
      Signed-off-by: NChao Leng <lengchao@huawei.com>
      Reviewed-by: NSagi Grimberg <sagi@grimberg.me>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      43efdb8e
    • L
      ibmvnic: save changed mac address to adapter->mac_addr · d9b0e599
      Lijun Pan 提交于
      After mac address change request completes successfully, the new mac
      address need to be saved to adapter->mac_addr as well as
      netdev->dev_addr. Otherwise, adapter->mac_addr still holds old
      data.
      
      Fixes: 62740e97 ("net/ibmvnic: Update MAC address settings after adapter reset")
      Signed-off-by: NLijun Pan <ljp@linux.ibm.com>
      Link: https://lore.kernel.org/r/20201020223919.46106-1-ljp@linux.ibm.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      d9b0e599
    • M
      Revert "virtio-net: ethtool configurable RXCSUM" · cf8691cb
      Michael S. Tsirkin 提交于
      This reverts commit 3618ad2a.
      
      When control vq is not negotiated, that commit causes a crash:
      
      [   72.229171] kernel BUG at drivers/net/virtio_net.c:1667!
      [   72.230266] invalid opcode: 0000 [#1] PREEMPT SMP
      [   72.231172] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.9.0-rc8-02934-g3618ad2a #1
      [   72.231172] EIP: virtnet_send_command+0x120/0x140
      [   72.231172] Code: 00 0f 94 c0 8b 7d f0 65 33 3d 14 00 00 00 75 1c 8d 65 f4 5b 5e 5f 5d c3 66 90 be 01 00 00 00 e9 6e ff ff ff 8d b6 00
      +00 00 00 <0f> 0b e8 d9 bb 82 00 eb 17 8d b4 26 00 00 00 00 8d b4 26 00 00 00
      [   72.231172] EAX: 0000000d EBX: f72895c0 ECX: 00000017 EDX: 00000011
      [   72.231172] ESI: f7197800 EDI: ed69bd00 EBP: ed69bcf4 ESP: ed69bc98
      [   72.231172] DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068 EFLAGS: 00010246
      [   72.231172] CR0: 80050033 CR2: 00000000 CR3: 02c84000 CR4: 000406f0
      [   72.231172] Call Trace:
      [   72.231172]  ? __virt_addr_valid+0x45/0x60
      [   72.231172]  ? ___cache_free+0x51f/0x760
      [   72.231172]  ? kobject_uevent_env+0xf4/0x560
      [   72.231172]  virtnet_set_guest_offloads+0x4d/0x80
      [   72.231172]  virtnet_set_features+0x85/0x120
      [   72.231172]  ? virtnet_set_guest_offloads+0x80/0x80
      [   72.231172]  __netdev_update_features+0x27a/0x8e0
      [   72.231172]  ? kobject_uevent+0xa/0x20
      [   72.231172]  ? netdev_register_kobject+0x12c/0x160
      [   72.231172]  register_netdevice+0x4fe/0x740
      [   72.231172]  register_netdev+0x1c/0x40
      [   72.231172]  virtnet_probe+0x728/0xb60
      [   72.231172]  ? _raw_spin_unlock+0x1d/0x40
      [   72.231172]  ? virtio_vdpa_get_status+0x1c/0x20
      [   72.231172]  virtio_dev_probe+0x1c6/0x271
      [   72.231172]  really_probe+0x195/0x2e0
      [   72.231172]  driver_probe_device+0x26/0x60
      [   72.231172]  device_driver_attach+0x49/0x60
      [   72.231172]  __driver_attach+0x46/0xc0
      [   72.231172]  ? device_driver_attach+0x60/0x60
      [   72.231172]  bus_add_driver+0x197/0x1c0
      [   72.231172]  driver_register+0x66/0xc0
      [   72.231172]  register_virtio_driver+0x1b/0x40
      [   72.231172]  virtio_net_driver_init+0x61/0x86
      [   72.231172]  ? veth_init+0x14/0x14
      [   72.231172]  do_one_initcall+0x76/0x2e4
      [   72.231172]  ? rdinit_setup+0x2a/0x2a
      [   72.231172]  do_initcalls+0xb2/0xd5
      [   72.231172]  kernel_init_freeable+0x14f/0x179
      [   72.231172]  ? rest_init+0x100/0x100
      [   72.231172]  kernel_init+0xd/0xe0
      [   72.231172]  ret_from_fork+0x1c/0x30
      [   72.231172] Modules linked in:
      [   72.269563] ---[ end trace a6ebc4afea0e6cb1 ]---
      
      The reason is that virtnet_set_features now calls virtnet_set_guest_offloads
      unconditionally, it used to only call it when there is something
      to configure.
      
      If device does not have a control vq, everything breaks.
      
      Revert the original commit for now.
      
      Cc: Tonghao Zhang <xiangxia.m.yue@gmail.com>
      Fixes: 3618ad2a ("virtio-net: ethtool configurable RXCSUM")
      Reported-by: Nkernel test robot <lkp@intel.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      Acked-by: NWillem de Bruijn <willemb@google.com>
      Acked-by: NJason Wang <jasowang@redhat.com>
      Link: https://lore.kernel.org/r/20201021142944.13615-1-mst@redhat.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      cf8691cb