1. 03 4月, 2019 1 次提交
    • P
      i915, uaccess: Fix redundant CLAC · 8f4faed0
      Peter Zijlstra 提交于
      New tooling noticed this:
      
       drivers/gpu/drm/i915/i915_gem_execbuffer.o: warning: objtool: .altinstr_replacement+0x3c: redundant UACCESS disable
       drivers/gpu/drm/i915/i915_gem_execbuffer.o: warning: objtool: .altinstr_replacement+0x66: redundant UACCESS disable
      
      You don't need user_access_end() if user_access_begin() fails.
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NIngo Molnar <mingo@kernel.org>
      8f4faed0
  2. 31 3月, 2019 2 次提交
  3. 30 3月, 2019 5 次提交
    • M
      drivers/block/zram/zram_drv.c: fix idle/writeback string compare · 0bc9f5d1
      Minchan Kim 提交于
      Makoto report a below KASAN error: zram does out-of-bounds read.  Because
      strscpy copies from source up to count bytes unconditionally.  It could
      cause out-of-bounds read on next object in slab.
      
      To prevent it, use strlcpy which checks source's length automatically.
      
         BUG: KASAN: slab-out-of-bounds in strscpy+0x68/0x154
         Read of size 8 at addr ffffffc0c3495a00 by task system_server/1314
         ..
         Call trace:
           strscpy+0x68/0x154
           idle_store+0xc4/0x34c
           dev_attr_store+0x50/0x6c
           sysfs_kf_write+0x98/0xb4
           kernfs_fop_write+0x198/0x260
           __vfs_write+0x10c/0x338
           vfs_write+0x114/0x238
           SyS_write+0xc8/0x168
           __sys_trace_return+0x0/0x4
      
         Allocated by task 1314:
          __kmalloc+0x280/0x318
          kernfs_fop_write+0xac/0x260
          __vfs_write+0x10c/0x338
          vfs_write+0x114/0x238
          SyS_write+0xc8/0x168
          __sys_trace_return+0x0/0x4
      
         Freed by task 2855:
          kfree+0x138/0x630
          kernfs_put_open_node+0x10c/0x124
          kernfs_fop_release+0xd8/0x114
          __fput+0x130/0x2a4
          ____fput+0x1c/0x28
          task_work_run+0x16c/0x1c8
          do_notify_resume+0x2bc/0x107c
          work_pending+0x8/0x10
      
         The buggy address belongs to the object at ffffffc0c3495a00
          which belongs to the cache kmalloc-128 of size 128
         The buggy address is located 0 bytes inside of
          128-byte region [ffffffc0c3495a00, ffffffc0c3495a80)
         The buggy address belongs to the page:
         page:ffffffbf030d2500 count:1 mapcount:0 mapping:          (null) index:0x0 compound_mapcount: 0
         flags: 0x4000000000010200(slab|head)
         page dumped because: kasan: bad access detected
      
         Memory state around the buggy address:
          ffffffc0c3495900: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
          ffffffc0c3495980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
         >ffffffc0c3495a00: 04 fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                            ^
          ffffffc0c3495a80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
          ffffffc0c3495b00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      
      Link: http://lkml.kernel.org/r/20190319231911.145968-1-minchan@kernel.org
      Cc: <stable@vger.kernel.org>	[5.0]
      Signed-off-by: NMinchan Kim <minchan@kernel.org>
      Reported-by: NMakoto Wu <makotowu@google.com>
      Reviewed-by: NSergey Senozhatsky <sergey.senozhatsky@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      0bc9f5d1
    • N
      iommu/io-pgtable-arm-v7s: request DMA32 memory, and improve debugging · 0a352554
      Nicolas Boichat 提交于
      IOMMUs using ARMv7 short-descriptor format require page tables (level 1
      and 2) to be allocated within the first 4GB of RAM, even on 64-bit
      systems.
      
      For level 1/2 pages, ensure GFP_DMA32 is used if CONFIG_ZONE_DMA32 is
      defined (e.g.  on arm64 platforms).
      
      For level 2 pages, allocate a slab cache in SLAB_CACHE_DMA32.  Note that
      we do not explicitly pass GFP_DMA[32] to kmem_cache_zalloc, as this is
      not strictly necessary, and would cause a warning in mm/sl*b.c, as we
      did not update GFP_SLAB_BUG_MASK.
      
      Also, print an error when the physical address does not fit in
      32-bit, to make debugging easier in the future.
      
      Link: http://lkml.kernel.org/r/20181210011504.122604-3-drinkcat@chromium.org
      Fixes: ad67f5a6 ("arm64: replace ZONE_DMA with ZONE_DMA32")
      Signed-off-by: NNicolas Boichat <drinkcat@chromium.org>
      Acked-by: NWill Deacon <will.deacon@arm.com>
      Cc: Christoph Hellwig <hch@infradead.org>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Hsin-Yi Wang <hsinyi@chromium.org>
      Cc: Huaisheng Ye <yehs1@lenovo.com>
      Cc: Joerg Roedel <joro@8bytes.org>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Matthias Brugger <matthias.bgg@gmail.com>
      Cc: Mel Gorman <mgorman@techsingularity.net>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
      Cc: Pekka Enberg <penberg@kernel.org>
      Cc: Robin Murphy <robin.murphy@arm.com>
      Cc: Sasha Levin <Alexander.Levin@microsoft.com>
      Cc: Tomasz Figa <tfiga@google.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Yingjoe Chen <yingjoe.chen@mediatek.com>
      Cc: Yong Wu <yong.wu@mediatek.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      0a352554
    • M
      staging: vt6655: Remove vif check from vnt_interrupt · cc26358f
      Malcolm Priestley 提交于
      A check for vif is made in vnt_interrupt_work.
      
      There is a small chance of leaving interrupt disabled while vif
      is NULL and the work hasn't been scheduled.
      Signed-off-by: NMalcolm Priestley <tvboxspy@gmail.com>
      CC: stable@vger.kernel.org # v4.2+
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      cc26358f
    • G
      staging: erofs: keep corrupted fs from crashing kernel in erofs_readdir() · 33bac912
      Gao Xiang 提交于
      After commit 419d6efc, kernel cannot be crashed in the namei
      path. However, corrupted nameoff can do harm in the process of
      readdir for scenerios without dm-verity as well. Fix it now.
      
      Fixes: 3aa8ec71 ("staging: erofs: add directory operations")
      Cc: <stable@vger.kernel.org> # 4.19+
      Signed-off-by: NGao Xiang <gaoxiang25@huawei.com>
      Reviewed-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      33bac912
    • J
      iommu/amd: Reserve exclusion range in iova-domain · 8aafaaf2
      Joerg Roedel 提交于
      If a device has an exclusion range specified in the IVRS
      table, this region needs to be reserved in the iova-domain
      of that device. This hasn't happened until now and can cause
      data corruption on data transfered with these devices.
      
      Treat exclusion ranges as reserved regions in the iommu-core
      to fix the problem.
      
      Fixes: be2a022c ('x86, AMD IOMMU: add functions to parse IOMMU memory mapping requirements for devices')
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      Reviewed-by: NGary R Hook <gary.hook@amd.com>
      8aafaaf2
  4. 29 3月, 2019 8 次提交
  5. 28 3月, 2019 17 次提交
    • R
      libata: fix using DMA buffers on stack · dd08a8d9
      raymond pang 提交于
      When CONFIG_VMAP_STACK=y, __pa() returns incorrect physical address for
      a stack virtual address. Stack DMA buffers must be avoided.
      Signed-off-by: Nraymond pang <raymondpangxd@gmail.com>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      dd08a8d9
    • J
      drm/i915/icl: Fix VEBOX mismatch BUG_ON() · 26cdaac4
      José Roberto de Souza 提交于
      GT VEBOX DISABLE is only 4 bits wide but it was using a 8 bits wide
      mask, the remaning reserved bits is set to 0 causing 4 more
      nonexistent VEBOX engines being detected as enabled, triggering the
      BUG_ON() because of mismatch between vebox_mask and newly added
      VEBOX_MASK().
      
      [   64.081621] [drm:intel_device_info_init_mmio [i915]] vdbox enable: 0005, instances: 0005
      [   64.081763] [drm:intel_device_info_init_mmio [i915]] vebox enable: 00f1, instances: 0001
      [   64.081825] intel_device_info_init_mmio:925 GEM_BUG_ON(vebox_mask != ({ unsigned int first__ = (VECS0); unsigned int count__ = (2); ((&(dev_priv)->__info)->engine_mask & (((~0UL) - (1UL << (first__)) + 1) & (~0UL >> (64 - 1 - (first__ + count__ - 1))))) >> first__; }))
      [   64.082047] ------------[ cut here ]------------
      [   64.082054] kernel BUG at drivers/gpu/drm/i915/intel_device_info.c:925!
      
      BSpec: 20680
      Fixes: 26376a7e ("drm/i915/icl: Check for fused-off VDBOX and VEBOX instances")
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
      Cc: Oscar Mateo <oscar.mateo@intel.com>
      Signed-off-by: NJosé Roberto de Souza <jose.souza@intel.com>
      Reviewed-by: NTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190326230223.26336-1-jose.souza@intel.com
      (cherry picked from commit 547fcf9b)
      Signed-off-by: NJani Nikula <jani.nikula@intel.com>
      26cdaac4
    • V
      cpufreq: scpi: Fix use after free · 31d4c528
      Vincent Stehlé 提交于
      Free the priv structure only after we are done using it.
      
      Fixes: 1690d8bb ("cpufreq: scpi/scmi: Fix freeing of dynamic OPPs")
      Signed-off-by: NVincent Stehlé <vincent.stehle@laposte.net>
      Cc: 4.20+ <stable@vger.kernel.org> # 4.20+
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      31d4c528
    • B
      USB: serial: option: add Olicard 600 · 84f3b43f
      Bjørn Mork 提交于
      This is a Qualcomm based device with a QMI function on interface 4.
      It is mode switched from 2020:2030 using a standard eject message.
      
      T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  6 Spd=480  MxCh= 0
      D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
      P:  Vendor=2020 ProdID=2031 Rev= 2.32
      S:  Manufacturer=Mobile Connect
      S:  Product=Mobile Connect
      S:  SerialNumber=0123456789ABCDEF
      C:* #Ifs= 6 Cfg#= 1 Atr=80 MxPwr=500mA
      I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
      E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
      E:  Ad=83(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
      E:  Ad=85(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
      E:  Ad=87(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
      E:  Ad=89(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
      E:  Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 5 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=(none)
      E:  Ad=8a(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=125us
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NBjørn Mork <bjorn@mork.no>
      [ johan: use tabs to align comments in adjacent lines ]
      Signed-off-by: NJohan Hovold <johan@kernel.org>
      84f3b43f
    • G
      USB: serial: cp210x: add new device id · a595ecdd
      Greg Kroah-Hartman 提交于
      Lorenz Messtechnik has a device that is controlled by the cp210x driver,
      so add the device id to the driver.  The device id was provided by
      Silicon-Labs for the devices from this vendor.
      Reported-by: NUli <t9cpu@web.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NJohan Hovold <johan@kernel.org>
      a595ecdd
    • T
      scsi: ibmvfc: Clean up transport events · d6e2635b
      Tyrel Datwyler 提交于
      No change to functionality. Simply make transport event messages a little
      clearer, and rework CRQ format enums such that we have separate enums for
      INIT messages and XPORT events.
      
      [mkp: typo]
      Signed-off-by: NTyrel Datwyler <tyreld@linux.vnet.ibm.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      d6e2635b
    • T
      scsi: ibmvfc: Byte swap status and error codes when logging · 3e6f7de4
      Tyrel Datwyler 提交于
      Status and error codes are returned in big endian from the VIOS. The values
      are translated into a human readable format when logged, but the values are
      also logged. This patch byte swaps those values so that they are consistent
      between BE and LE platforms.
      Signed-off-by: NTyrel Datwyler <tyreld@linux.vnet.ibm.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      3e6f7de4
    • T
      scsi: ibmvfc: Add failed PRLI to cmd_status lookup array · 95237c25
      Tyrel Datwyler 提交于
      The VIOS uses the SCSI_ERROR class to report PRLI failures. These errors
      are indicated with the combination of a IBMVFC_FC_SCSI_ERROR return status
      and 0x8000 error code. Add these codes to cmd_status[] with appropriate
      human readable error message.
      Signed-off-by: NTyrel Datwyler <tyreld@linux.vnet.ibm.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      95237c25
    • T
      scsi: ibmvfc: Remove "failed" from logged errors · 6dc6a944
      Tyrel Datwyler 提交于
      The text of messages logged with ibmvfc_log_error() always contain the term
      "failed". In the case of cancelled commands during EH they are reported
      back by the VIOS using error codes. This can be confusing to somebody
      looking at these log messages as to whether a command was successfully
      cancelled. The following real log message for example it is unclear if the
      transaction was actaully cancelled.
      
      <6>sd 0:0:1:1: Cancelling outstanding commands.
      <3>sd 0:0:1:1: [sde] Command (28) failed: transaction cancelled (2:6) flags: 0 fcp_rsp: 0, resid=0, scsi_status: 0
      
      Remove prefixing of "failed" to all error logged messages. The
      ibmvfc_log_error() function translates the returned error/status codes to a
      human readable message already.
      Signed-off-by: NTyrel Datwyler <tyreld@linux.vnet.ibm.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      6dc6a944
    • S
      scsi: zfcp: reduce flood of fcrscn1 trace records on multi-element RSCN · c8206579
      Steffen Maier 提交于
      If an incoming ELS of type RSCN contains more than one element, zfcp
      suboptimally causes repeated erp trigger NOP trace records for each
      previously failed port. These could be ports that went away.  It loops over
      each RSCN element, and for each of those in an inner loop over all
      zfcp_ports.
      
      The trigger to recover failed ports should be just the reception of some
      RSCN, no matter how many elements it has. So we can loop over failed ports
      separately, and only then loop over each RSCN element to handle the
      non-failed ports.
      
      The call chain was:
      
        zfcp_fc_incoming_rscn
          for (i = 1; i < no_entries; i++)
            _zfcp_fc_incoming_rscn
              list_for_each_entry(port, &adapter->port_list, list)
                if (masked port->d_id match) zfcp_fc_test_link
                if (!port->d_id) zfcp_erp_port_reopen "fcrscn1"   <===
      
      In order the reduce the "flooding" of the REC trace area in such cases, we
      factor out handling the failed ports to be outside of the entries loop:
      
        zfcp_fc_incoming_rscn
          if (no_entries > 1)                                     <===
            list_for_each_entry(port, &adapter->port_list, list)  <===
              if (!port->d_id) zfcp_erp_port_reopen "fcrscn1"     <===
          for (i = 1; i < no_entries; i++)
            _zfcp_fc_incoming_rscn
              list_for_each_entry(port, &adapter->port_list, list)
                if (masked port->d_id match) zfcp_fc_test_link
      
      Abbreviated example trace records before this code change:
      
      Tag            : fcrscn1
      WWPN           : 0x500507630310d327
      ERP want       : 0x02
      ERP need       : 0x02
      
      Tag            : fcrscn1
      WWPN           : 0x500507630310d327
      ERP want       : 0x02
      ERP need       : 0x00                 NOP => superfluous trace record
      
      The last trace entry repeats if there are more than 2 RSCN elements.
      Signed-off-by: NSteffen Maier <maier@linux.ibm.com>
      Reviewed-by: NBenjamin Block <bblock@linux.ibm.com>
      Reviewed-by: NJens Remus <jremus@linux.ibm.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      c8206579
    • S
      scsi: zfcp: fix scsi_eh host reset with port_forced ERP for non-NPIV FCP devices · 242ec145
      Steffen Maier 提交于
      Suppose more than one non-NPIV FCP device is active on the same channel.
      Send I/O to storage and have some of the pending I/O run into a SCSI
      command timeout, e.g. due to bit errors on the fibre. Now the error
      situation stops. However, we saw FCP requests continue to timeout in the
      channel. The abort will be successful, but the subsequent TUR fails.
      Scsi_eh starts. The LUN reset fails. The target reset fails.  The host
      reset only did an FCP device recovery. However, for non-NPIV FCP devices,
      this does not close and reopen ports on the SAN-side if other non-NPIV FCP
      device(s) share the same open ports.
      
      In order to resolve the continuing FCP request timeouts, we need to
      explicitly close and reopen ports on the SAN-side.
      
      This was missing since the beginning of zfcp in v2.6.0 history commit
      ea127f975424 ("[PATCH] s390 (7/7): zfcp host adapter.").
      
      Note: The FSF requests for forced port reopen could run into FSF request
      timeouts due to other reasons. This would trigger an internal FCP device
      recovery. Pending forced port reopen recoveries would get dismissed. So
      some ports might not get fully reopened during this host reset handler.
      However, subsequent I/O would trigger the above described escalation and
      eventually all ports would be forced reopen to resolve any continuing FCP
      request timeouts due to earlier bit errors.
      Signed-off-by: NSteffen Maier <maier@linux.ibm.com>
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Cc: <stable@vger.kernel.org> #3.0+
      Reviewed-by: NJens Remus <jremus@linux.ibm.com>
      Reviewed-by: NBenjamin Block <bblock@linux.ibm.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      242ec145
    • S
      scsi: zfcp: fix rport unblock if deleted SCSI devices on Scsi_Host · fe67888f
      Steffen Maier 提交于
      An already deleted SCSI device can exist on the Scsi_Host and remain there
      because something still holds a reference.  A new SCSI device with the same
      H:C:T:L and FCP device, target port WWPN, and FCP LUN can be created.  When
      we try to unblock an rport, we still find the deleted SCSI device and
      return early because the zfcp_scsi_dev of that SCSI device is not
      ZFCP_STATUS_COMMON_UNBLOCKED. Hence we miss to unblock the rport, even if
      the new proper SCSI device would be in good state.
      
      Therefore, skip deleted SCSI devices when iterating the sdevs of the shost.
      [cf. __scsi_device_lookup{_by_target}() or scsi_device_get()]
      
      The following abbreviated trace sequence can indicate such problem:
      
      Area           : REC
      Tag            : ersfs_3
      LUN            : 0x4045400300000000
      WWPN           : 0x50050763031bd327
      LUN status     : 0x40000000     not ZFCP_STATUS_COMMON_UNBLOCKED
      Ready count    : n		not incremented yet
      Running count  : 0x00000000
      ERP want       : 0x01
      ERP need       : 0xc1		ZFCP_ERP_ACTION_NONE
      
      Area           : REC
      Tag            : ersfs_3
      LUN            : 0x4045400300000000
      WWPN           : 0x50050763031bd327
      LUN status     : 0x41000000
      Ready count    : n+1
      Running count  : 0x00000000
      ERP want       : 0x01
      ERP need       : 0x01
      
      ...
      
      Area           : REC
      Level          : 4		only with increased trace level
      Tag            : ertru_l
      LUN            : 0x4045400300000000
      WWPN           : 0x50050763031bd327
      LUN status     : 0x40000000
      Request ID     : 0x0000000000000000
      ERP status     : 0x01800000
      ERP step       : 0x1000
      ERP action     : 0x01
      ERP count      : 0x00
      
      NOT followed by a trace record with tag "scpaddy"
      for WWPN 0x50050763031bd327.
      Signed-off-by: NSteffen Maier <maier@linux.ibm.com>
      Fixes: 6f2ce1c6 ("scsi: zfcp: fix rport unblock race with LUN recovery")
      Cc: <stable@vger.kernel.org> #2.6.32+
      Reviewed-by: NJens Remus <jremus@linux.ibm.com>
      Reviewed-by: NBenjamin Block <bblock@linux.ibm.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      fe67888f
    • M
      scsi: sd: Quiesce warning if device does not report optimal I/O size · 1d5de5bd
      Martin K. Petersen 提交于
      Commit a83da8a4 ("scsi: sd: Optimal I/O size should be a multiple
      of physical block size") split one conditional into several separate
      statements in an effort to provide more accurate warning messages when
      a device reports a nonsensical value. However, this reorganization
      accidentally dropped the precondition of the reported value being
      larger than zero. This lead to a warning getting emitted on devices
      that do not report an optimal I/O size at all.
      
      Remain silent if a device does not report an optimal I/O size.
      
      Fixes: a83da8a4 ("scsi: sd: Optimal I/O size should be a multiple of physical block size")
      Cc: Randy Dunlap <rdunlap@infradead.org>
      Cc: <stable@vger.kernel.org>
      Reported-by: NHussam Al-Tayeb <ht990332@gmx.com>
      Tested-by: NHussam Al-Tayeb <ht990332@gmx.com>
      Reviewed-by: NBart Van Assche <bvanassche@acm.org>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      1d5de5bd
    • B
      scsi: sd: Fix a race between closing an sd device and sd I/O · c14a5726
      Bart Van Assche 提交于
      The scsi_end_request() function calls scsi_cmd_to_driver() indirectly and
      hence needs the disk->private_data pointer. Avoid that that pointer is
      cleared before all affected I/O requests have finished. This patch avoids
      that the following crash occurs:
      
      Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
      Call trace:
       scsi_mq_uninit_cmd+0x1c/0x30
       scsi_end_request+0x7c/0x1b8
       scsi_io_completion+0x464/0x668
       scsi_finish_command+0xbc/0x160
       scsi_eh_flush_done_q+0x10c/0x170
       sas_scsi_recover_host+0x84c/0xa98 [libsas]
       scsi_error_handler+0x140/0x5b0
       kthread+0x100/0x12c
       ret_from_fork+0x10/0x18
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Ming Lei <ming.lei@redhat.com>
      Cc: Hannes Reinecke <hare@suse.com>
      Cc: Johannes Thumshirn <jthumshirn@suse.de>
      Cc: Jason Yan <yanaijie@huawei.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NBart Van Assche <bvanassche@acm.org>
      Reported-by: NJason Yan <yanaijie@huawei.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      c14a5726
    • Z
      scsi: core: Run queue when state is set to running after being blocked · 70fc085c
      zhengbin 提交于
      Use dd to test a SCSI device:
      
        1. echo "blocked" >/sys/block/sda/device/state
        2. dd if=/dev/sda of=/mnt/t.log bs=1M count=10
        3. echo "running" >/sys/block/sda/device/state
      
      dd should finish this work after step 3, but it hangs.
      
      After step2, the call chain is this:
      
      blk_mq_dispatch_rq_list-->scsi_queue_rq-->prep_to_mq
      
      prep_to_mq will return BLK_STS_RESOURCE, and scsi_queue_rq will
      transition it to BLK_STS_DEV_RESOURCE which means that driver can
      guarantee that IO dispatch will be triggered in future when the
      resource is available.  Need to follow the rule if we set the device
      state to running.
      
      [mkp: tweaked commit description and code comment as suggested by Bart]
      Signed-off-by: Nzhengbin <zhengbin13@huawei.com>
      Reviewed-by: NMing Lei <ming.lei@redhat.com>
      Reviewed-by: NBart Van Assche <bvanassche@acm.org>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      70fc085c
    • H
      virt: vbox: Implement passing requestor info to the host for VirtualBox 6.0.x · 0532a1b0
      Hans de Goede 提交于
      VirtualBox 6.0.x has a new feature where the guest kernel driver passes
      info about the origin of the request (e.g. userspace or kernelspace) to
      the hypervisor.
      
      If we do not pass this information then when running the 6.0.x userspace
      guest-additions tools on a 6.0.x host, some requests will get denied
      with a VERR_VERSION_MISMATCH error, breaking vboxservice.service and
      the mounting of shared folders marked to be auto-mounted.
      
      This commit implements passing the requestor info to the host, fixing this.
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0532a1b0
    • F
      tty: fix NULL pointer issue when tty_port ops is not set · f4e68d58
      Fabien Dessenne 提交于
      Unlike 'client_ops' which is initialized to 'default_client_ops', the
      port operations 'ops' may be left to NULL.
      Check the 'ops' value before checking the 'ops->x' value.
      Signed-off-by: NFabien Dessenne <fabien.dessenne@st.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f4e68d58
  6. 27 3月, 2019 7 次提交
    • W
      Disable kgdboc failed by echo space to /sys/module/kgdboc/parameters/kgdboc · 3ec80029
      Wentao Wang 提交于
      Echo "" to /sys/module/kgdboc/parameters/kgdboc will fail with "No such
      device” error.
      
      This is caused by function "configure_kgdboc" who init err to ENODEV
      when the config is empty (legal input) the code go out with ENODEV
      returned.
      
      Fixes: 2dd45316 ("kgdboc: Fix restrict error")
      Signed-off-by: NWentao Wang <witallwang@gmail.com>
      Cc: stable <stable@vger.kernel.org>
      Acked-by: NDaniel Thompson <daniel.thompson@linaro.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3ec80029
    • R
      tty/serial: atmel: RS485 HD w/DMA: enable RX after TX is stopped · 69646d7a
      Razvan Stefanescu 提交于
      In half-duplex operation, RX should be started after TX completes.
      
      If DMA is used, there is a case when the DMA transfer completes but the
      TX FIFO is not emptied, so the RX cannot be restarted just yet.
      
      Use a boolean variable to store this state and rearm TX interrupt mask
      to be signaled again that the transfer finished. In interrupt transmit
      handler this variable is used to start RX. A warning message is generated
      if RX is activated before TX fifo is cleared.
      
      Fixes: b389f173 ("tty/serial: atmel: RS485 half duplex w/DMA: enable
      RX after TX is done")
      Signed-off-by: NRazvan Stefanescu <razvan.stefanescu@microchip.com>
      Acked-by: NRichard Genoud <richard.genoud@gmail.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      69646d7a
    • R
      tty/serial: atmel: Add is_half_duplex helper · f3040983
      Razvan Stefanescu 提交于
      Use a helper function to check that a port needs to use half duplex
      communication, replacing several occurrences of multi-line bit checking.
      
      Fixes: b389f173 ("tty/serial: atmel: RS485 half duplex w/DMA: enable RX after TX is done")
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NRazvan Stefanescu <razvan.stefanescu@microchip.com>
      Acked-by: NRichard Genoud <richard.genoud@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f3040983
    • M
      usb: u132-hcd: fix resource leak · f276e002
      Mukesh Ojha 提交于
      if platform_driver_register fails, cleanup the allocated resource
      gracefully.
      Signed-off-by: NMukesh Ojha <mojha@codeaurora.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f276e002
    • R
      usb: cdc-acm: fix race during wakeup blocking TX traffic · 93e1c8a6
      Romain Izard 提交于
      When the kernel is compiled with preemption enabled, the URB completion
      handler can run in parallel with the work responsible for waking up the
      tty layer. If the URB handler sets the EVENT_TTY_WAKEUP bit during the
      call to tty_port_tty_wakeup() to signal that there is room for additional
      input, it will be cleared at the end of this call. As a result, TX traffic
      on the upper layer will be blocked.
      
      This can be seen with a kernel configured with CONFIG_PREEMPT, and a fast
      modem connected with PPP running over a USB CDC-ACM port.
      
      Use test_and_clear_bit() instead, which ensures that each wakeup requested
      by the URB completion code will trigger a call to tty_port_tty_wakeup().
      
      Fixes: 1aba579f cdc-acm: handle read pipe errors
      Signed-off-by: NRomain Izard <romain.izard.pro@gmail.com>
      Cc: stable <stable@vger.kernel.org>
      Acked-by: NOliver Neukum <oneukum@suse.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      93e1c8a6
    • B
      gpio: mockup: fix debugfs read · 2583303d
      Bartosz Golaszewski 提交于
      The debugfs read callback must advance ppos or users using read() on
      the file descriptor will never get the EOL. This wasn't spotted before
      as I was using busybox cat for testing which uses sendfile() internally
      and only noticed it now when switched to cat from coreutils.
      
      Fixes: 2a9e2740 ("gpio: mockup: rework debugfs interface")
      Signed-off-by: NBartosz Golaszewski <bgolaszewski@baylibre.com>
      2583303d
    • A
      Revert "gpio: use new gpio_set_config() helper in more places" · fa59dd23
      Andrew Jeffery 提交于
      gpio-aspeed implements support for PIN_CONFIG_INPUT_DEBOUNCE. As of
      v5.1-rc1 we're seeing the following when booting a Romulus BMC kernel:
      
      > [   21.373137] ------------[ cut here ]------------
      > [   21.374545] WARNING: CPU: 0 PID: 1 at drivers/gpio/gpio-aspeed.c:834 unregister_allocated_timer+0x38/0x94
      > [   21.376181] No timer allocated to offset 74
      > [   21.377672] CPU: 0 PID: 1 Comm: swapper Not tainted 5.1.0-rc1-dirty #6
      > [   21.378800] Hardware name: Generic DT based system
      > [   21.379965] Backtrace:
      > [   21.381024] [<80107d44>] (dump_backtrace) from [<80107f78>] (show_stack+0x20/0x24)
      > [   21.382713]  r7:8038b720 r6:00000009 r5:00000000 r4:87897c64
      > [   21.383815] [<80107f58>] (show_stack) from [<80656398>] (dump_stack+0x20/0x28)
      > [   21.385042] [<80656378>] (dump_stack) from [<80115f1c>] (__warn.part.3+0xb4/0xdc)
      > [   21.386253] [<80115e68>] (__warn.part.3) from [<80115fb0>] (warn_slowpath_fmt+0x6c/0x90)
      > [   21.387471]  r6:00000342 r5:807f8758 r4:80a07008
      > [   21.388278] [<80115f48>] (warn_slowpath_fmt) from [<8038b720>] (unregister_allocated_timer+0x38/0x94)
      > [   21.389809]  r3:0000004a r2:807f8774
      > [   21.390526]  r7:00000000 r6:0000000a r5:60000153 r4:0000004a
      > [   21.391601] [<8038b6e8>] (unregister_allocated_timer) from [<8038baac>] (aspeed_gpio_set_config+0x330/0x48c)
      > [   21.393248] [<8038b77c>] (aspeed_gpio_set_config) from [<803840b0>] (gpiod_set_debounce+0xe8/0x114)
      > [   21.394745]  r10:82ee2248 r9:00000000 r8:87b63a00 r7:00001388 r6:87947320 r5:80729310
      > [   21.396030]  r4:879f64a0
      > [   21.396499] [<80383fc8>] (gpiod_set_debounce) from [<804b4350>] (gpio_keys_probe+0x69c/0x8e0)
      > [   21.397715]  r7:845d94b8 r6:00000001 r5:00000000 r4:87b63a1c
      > [   21.398618] [<804b3cb4>] (gpio_keys_probe) from [<8040eeec>] (platform_dev_probe+0x44/0x80)
      > [   21.399834]  r10:00000003 r9:80a3a8b0 r8:00000000 r7:00000000 r6:80a7f9dc r5:80a3a8b0
      > [   21.401163]  r4:8796bc10
      > [   21.401634] [<8040eea8>] (platform_drv_probe) from [<8040d0d4>] (really_probe+0x208/0x3dc)
      > [   21.402786]  r5:80a7f8d0 r4:8796bc10
      > [   21.403547] [<8040cecc>] (really_probe) from [<8040d7a4>] (driver_probe_device+0x130/0x170)
      > [   21.404744]  r10:0000007b r9:8093683c r8:00000000 r7:80a07008 r6:80a3a8b0 r5:8796bc10
      > [   21.405854]  r4:80a3a8b0
      > [   21.406324] [<8040d674>] (driver_probe_device) from [<8040da8c>] (device_driver_attach+0x68/0x70)
      > [   21.407568]  r9:8093683c r8:00000000 r7:80a07008 r6:80a3a8b0 r5:00000000 r4:8796bc10
      > [   21.408877] [<8040da24>] (device_driver_attach) from [<8040db14>] (__driver_attach+0x80/0x150)
      > [   21.410327]  r7:80a07008 r6:8796bc10 r5:00000001 r4:80a3a8b0
      > [   21.411294] [<8040da94>] (__driver_attach) from [<8040b20c>] (bus_for_each_dev+0x80/0xc4)
      > [   21.412641]  r7:80a07008 r6:8040da94 r5:80a3a8b0 r4:87966f30
      > [   21.413580] [<8040b18c>] (bus_for_each_dev) from [<8040dc0c>] (driver_attach+0x28/0x30)
      > [   21.414943]  r7:00000000 r6:87b411e0 r5:80a33fc8 r4:80a3a8b0
      > [   21.415927] [<8040dbe4>] (driver_attach) from [<8040bbf0>] (bus_add_driver+0x14c/0x200)
      > [   21.417289] [<8040baa4>] (bus_add_driver) from [<8040e2b4>] (driver_register+0x84/0x118)
      > [   21.418652]  r7:80a60ae0 r6:809226b8 r5:80a07008 r4:80a3a8b0
      > [   21.419652] [<8040e230>] (driver_register) from [<8040fc28>] (__platform_driver_register+0x3c/0x50)
      > [   21.421193]  r5:80a07008 r4:809525f8
      > [   21.421990] [<8040fbec>] (__platform_driver_register) from [<809226d8>] (gpio_keys_init+0x20/0x28)
      > [   21.423447] [<809226b8>] (gpio_keys_init) from [<8090128c>] (do_one_initcall+0x80/0x180)
      > [   21.424886] [<8090120c>] (do_one_initcall) from [<80901538>] (kernel_init_freeable+0x1ac/0x26c)
      > [   21.426354]  r8:80a60ae0 r7:80a60ae0 r6:8093685c r5:00000008 r4:809525f8
      > [   21.427579] [<8090138c>] (kernel_init_freeable) from [<8066d9a0>] (kernel_init+0x18/0x11c)
      > [   21.428819]  r10:00000000 r9:00000000 r8:00000000 r7:00000000 r6:00000000 r5:8066d988
      > [   21.429947]  r4:00000000
      > [   21.430415] [<8066d988>] (kernel_init) from [<801010e8>] (ret_from_fork+0x14/0x2c)
      > [   21.431666] Exception stack(0x87897fb0 to 0x87897ff8)
      > [   21.432877] 7fa0:                                     00000000 00000000 00000000 00000000
      > [   21.434446] 7fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
      > [   21.436052] 7fe0: 00000000 00000000 00000000 00000000 00000013 00000000
      > [   21.437308]  r5:8066d988 r4:00000000
      > [   21.438102] ---[ end trace d7d7ac3a80567d0e ]---
      
      We only hit unregister_allocated_timer() if the argument to
      aspeed_gpio_set_config() is 0, but we can't be calling through
      gpiod_set_debounce() from gpio_keys_probe() unless the gpio-keys button has a
      non-zero debounce interval.
      
      Commit 6581eaf0 ("gpio: use new gpio_set_config() helper in more places")
      spreads the use of gpio_set_config() to the debounce and transitory
      state configuration paths. The implementation of gpio_set_config() is:
      
      > static int gpio_set_config(struct gpio_chip *gc, unsigned offset,
      > 			   enum pin_config_param mode)
      > {
      > 	unsigned long config = { PIN_CONF_PACKED(mode, 0) };
      >
      > 	return gc->set_config ? gc->set_config(gc, offset, config) : -ENOTSUPP;
      > }
      
      Here it packs its own config value with a fixed argument of 0; this is
      incorrect behaviour for implementing the debounce and transitory functions, and
      the debounce and transitory gpio_set_config() call-sites now have an undetected
      type mismatch as they both already pack their own config parameter (i.e. what
      gets passed is not an `enum pin_config_param`). Indeed this can be seen in the
      small diff for 6581eaf0:
      
      > diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
      > index de595fa31a1a..1f239aac43df 100644
      > --- a/drivers/gpio/gpiolib.c
      > +++ b/drivers/gpio/gpiolib.c
      > @@ -2725,7 +2725,7 @@ int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce)
      >         }
      >
      >         config = pinconf_to_config_packed(PIN_CONFIG_INPUT_DEBOUNCE, debounce);
      > -       return chip->set_config(chip, gpio_chip_hwgpio(desc), config);
      > +       return gpio_set_config(chip, gpio_chip_hwgpio(desc), config);
      >  }
      >  EXPORT_SYMBOL_GPL(gpiod_set_debounce);
      >
      > @@ -2762,7 +2762,7 @@ int gpiod_set_transitory(struct gpio_desc *desc, bool transitory)
      >         packed = pinconf_to_config_packed(PIN_CONFIG_PERSIST_STATE,
      >                                           !transitory);
      >         gpio = gpio_chip_hwgpio(desc);
      > -       rc = chip->set_config(chip, gpio, packed);
      > +       rc = gpio_set_config(chip, gpio, packed);
      >         if (rc == -ENOTSUPP) {
      >                 dev_dbg(&desc->gdev->dev, "Persistence not supported for GPIO %d\n",
      >                                 gpio);
      
      Revert commit 6581eaf0 ("gpio: use new gpio_set_config() helper in
      more places") to restore correct behaviour for gpiod_set_debounce() and
      gpiod_set_transitory().
      
      Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
      Signed-off-by: NAndrew Jeffery <andrew@aj.id.au>
      Signed-off-by: NBartosz Golaszewski <bgolaszewski@baylibre.com>
      fa59dd23