1. 08 May, 2017 14 commits
    • Arnd Bergmann's avatar
      IB/ehca: fix maybe-uninitialized warnings · fee1f42b
      Arnd Bergmann authored
      The driver causes two warnings about possibly uninitialized variables:
      
      drivers/infiniband/hw/ehca/ehca_mrmw.c: In function 'ehca_set_pagebuf':
      drivers/infiniband/hw/ehca/ehca_mrmw.c:1908:4: warning: 'prev_pgaddr' may be used uninitialized in this function [-Wmaybe-uninitialized]
      drivers/infiniband/hw/ehca/ehca_mrmw.c:1924:14: note: 'prev_pgaddr' was declared here
      drivers/infiniband/hw/ehca/ehca_mrmw.c: In function 'ehca_reg_mr':
      drivers/infiniband/hw/ehca/ehca_mrmw.c:2430:5: warning: 'hret' may be used uninitialized in this function [-Wmaybe-uninitialized]
      
      The first one is definitely a false positive, the second one may or may not
      be one. In both cases, adding an intialization is the safe and easy
      workaround.
      
      The driver was removed in mainline in commit e581d111
      ("staging/rdma: remove deprecated ehca driver"), in linux-4.6.
      In 4.4, the file is located in drivers/staging/rdma/ehca/ehca_mrmw.c,
      and the fix still applies.
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fee1f42b
    • Arnd Bergmann's avatar
      IB/qib: rename BITS_PER_PAGE to RVT_BITS_PER_PAGE · 56cd2ed3
      Arnd Bergmann authored
      We get this build warning on arm64
      
      drivers/infiniband/hw/qib/qib_qp.c:44:0: error: "BITS_PER_PAGE" redefined [-Werror]
       #define BITS_PER_PAGE           (PAGE_SIZE*BITS_PER_BYTE)
      
      This is fixed upstream in commit 898fa52b ("IB/qib: Remove qpn, qp tables and
      related variables from qib"), which does a lot of other things as well.
      
      Instead, I just backport the rename of the local BITS_PER_PAGE definition to
      RVT_BITS_PER_PAGE.
      
      The driver first showed up in linux-2.6.35, and the fixup should still apply
      to that. The upstream fix went into v4.6, so we could apply this workaround
      to both 3.18 and 4.4.
      
      Fixes: f931551b ("IB/qib: Add new qib driver for QLogic PCIe InfiniBand adapters")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      56cd2ed3
    • Ross Lagerwall's avatar
      netlink: Allow direct reclaim for fallback allocation · a8d47b4b
      Ross Lagerwall authored
      The backport of d35c99ff ("netlink: do not enter direct reclaim from
      netlink_dump()") to the 4.4 branch (first in 4.4.32) mistakenly removed
      direct claim from the initial large allocation _and_ the fallback
      allocation which means that allocations can spuriously fail.
      Fix the issue by adding back the direct reclaim flag to the fallback
      allocation.
      
      Fixes: 6d123f1d ("netlink: do not enter direct reclaim from netlink_dump()")
      Signed-off-by: default avatarRoss Lagerwall <ross.lagerwall@citrix.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a8d47b4b
    • Gabriel Krisman Bertazi's avatar
      8250_pci: Fix potential use-after-free in error path · 35c9bfa5
      Gabriel Krisman Bertazi authored
      commit c130b666 upstream.
      
      Commit f209fa03 ("serial: 8250_pci: Detach low-level driver during
      PCI error recovery") introduces a potential use-after-free in case the
      pciserial_init_ports call in serial8250_io_resume fails, which may
      happen if a memory allocation fails or if the .init quirk failed for
      whatever reason).  If this happen, further pci_get_drvdata will return a
      pointer to freed memory.
      
      This patch reworks the PCI recovery resume hook to restore the old priv
      structure in this case, which should be ok, since the ports were already
      detached. Such error during recovery causes us to give up on the
      recovery.
      
      Fixes: f209fa03 ("serial: 8250_pci: Detach low-level driver during PCI error recovery")
      Reported-by: default avatarMichal Suchanek <msuchanek@suse.com>
      Signed-off-by: default avatarGabriel Krisman Bertazi <krisman@linux.vnet.ibm.com>
      Signed-off-by: default avatarGuilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com>
      Cc: Sumit Semwal <sumit.semwal@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      35c9bfa5
    • Matthew R. Ochs's avatar
      scsi: cxlflash: Improve EEH recovery time · 6f81dea4
      Matthew R. Ochs authored
      commit 05dab432 upstream.
      
      When an EEH occurs during device initialization, the port timeout logic
      can cause excessive delays as MMIO reads will fail. Depending on where
      they are experienced, these delays can lead to a prolonged reset,
      causing an unnecessary triggering of other timeout logic in the SCSI
      stack or user applications.
      
      To expedite recovery, the port timeout logic is updated to decay the
      timeout at a much faster rate when in the presence of a likely EEH
      frozen event.
      Signed-off-by: default avatarMatthew R. Ochs <mrochs@linux.vnet.ibm.com>
      Acked-by: default avatarUma Krishnan <ukrishn@linux.vnet.ibm.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Cc: Sumit Semwal <sumit.semwal@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6f81dea4
    • Matthew R. Ochs's avatar
      scsi: cxlflash: Fix to avoid EEH and host reset collisions · 24d17d78
      Matthew R. Ochs authored
      commit 1d3324c3 upstream.
      
      The EEH reset handler is ignorant to the current state of the driver
      when processing a frozen event and initiating a device reset. This can
      be an issue if an EEH event occurs while a user or stack initiated reset
      is executing. More specifically, if an EEH occurs while the SCSI host
      reset handler is active, the reset initiated by the EEH thread will
      likely collide with the host reset thread. This can leave the device in
      an inconsistent state, or worse, cause a system crash.
      
      As a remedy, the EEH handler is updated to evaluate the device state and
      take appropriate action (proceed, wait, or disconnect host). The host
      reset handler is also updated to handle situations where an EEH occurred
      during a host reset. In such situations, the host reset handler will
      delay reporting back a success to give the EEH reset an opportunity to
      complete.
      Signed-off-by: default avatarMatthew R. Ochs <mrochs@linux.vnet.ibm.com>
      Acked-by: default avatarUma Krishnan <ukrishn@linux.vnet.ibm.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Cc: Sumit Semwal <sumit.semwal@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      24d17d78
    • Uma Krishnan's avatar
      scsi: cxlflash: Scan host only after the port is ready for I/O · 69a9e016
      Uma Krishnan authored
      commit bbbfae96 upstream.
      
      When a port link is established, the AFU sends a 'link up' interrupt.
      After the link is up, corresponding initialization steps are performed
      on the card. Following that, when the card is ready for I/O, the AFU
      sends 'login succeeded' interrupt. Today, cxlflash invokes
      scsi_scan_host() upon receipt of both interrupts.
      
      SCSI commands sent to the port prior to the 'login succeeded' interrupt
      will fail with 'port not available' error. This is not desirable.
      Moreover, when async_scan is active for the host, subsequent scan calls
      are terminated with error. Due to this, the scsi_scan_host() call
      performed after 'login succeeded' interrupt could portentially return
      error and the devices may not be scanned properly.
      
      To avoid this problem, scsi_scan_host() should be called only after the
      'login succeeded' interrupt.
      Signed-off-by: default avatarUma Krishnan <ukrishn@linux.vnet.ibm.com>
      Acked-by: default avatarMatthew R. Ochs <mrochs@linux.vnet.ibm.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Cc: Sumit Semwal <sumit.semwal@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      69a9e016
    • Arnd Bergmann's avatar
      net: tg3: avoid uninitialized variable warning · ec2170f9
      Arnd Bergmann authored
      commit e434e041 upstream.
      
      The tg3_set_eeprom() function correctly initializes the 'start' variable,
      but gcc generates a false warning:
      
      drivers/net/ethernet/broadcom/tg3.c: In function 'tg3_set_eeprom':
      drivers/net/ethernet/broadcom/tg3.c:12057:4: warning: 'start' may be used uninitialized in this function [-Wmaybe-uninitialized]
      
      I have not come up with a way to restructure the code in a way that
      avoids the warning without making it less readable, so this adds an
      initialization for the declaration to shut up that warning.
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ec2170f9
    • Arnd Bergmann's avatar
      mtd: avoid stack overflow in MTD CFI code · fd79e436
      Arnd Bergmann authored
      commit fddcca51 upstream.
      
      When map_word gets too large, we use a lot of kernel stack, and for
      MTD_MAP_BANK_WIDTH_32, this means we use more than the recommended
      1024 bytes in a number of functions:
      
      drivers/mtd/chips/cfi_cmdset_0020.c: In function 'cfi_staa_write_buffers':
      drivers/mtd/chips/cfi_cmdset_0020.c:651:1: warning: the frame size of 1336 bytes is larger than 1024 bytes [-Wframe-larger-than=]
      drivers/mtd/chips/cfi_cmdset_0020.c: In function 'cfi_staa_erase_varsize':
      drivers/mtd/chips/cfi_cmdset_0020.c:972:1: warning: the frame size of 1208 bytes is larger than 1024 bytes [-Wframe-larger-than=]
      drivers/mtd/chips/cfi_cmdset_0001.c: In function 'do_write_buffer':
      drivers/mtd/chips/cfi_cmdset_0001.c:1835:1: warning: the frame size of 1240 bytes is larger than 1024 bytes [-Wframe-larger-than=]
      
      This can be avoided if all operations on the map word are done
      indirectly and the stack gets reused between the calls. We can
      mostly achieve this by selecting MTD_COMPLEX_MAPPINGS whenever
      MTD_MAP_BANK_WIDTH_32 is set, but for the case that no other
      bank width is enabled, we also need to use a non-constant
      map_bankwidth() to convince the compiler to use less stack.
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      [Brian: this patch mostly achieves its goal by forcing
          MTD_COMPLEX_MAPPINGS (and the accompanying indirection) for 256-bit
          mappings; the rest of the change is mostly a wash, though it helps
          reduce stack size slightly. If we really care about supporting
          256-bit mappings though, we should consider rewriting some of this
          code to avoid keeping and assigning so many 256-bit objects on the
          stack.]
      Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fd79e436
    • Lars Ellenberg's avatar
      drbd: avoid redefinition of BITS_PER_PAGE · ee6b8876
      Lars Ellenberg authored
      commit 2630628b upstream.
      
      Apparently we now implicitly get definitions for BITS_PER_PAGE and
      BITS_PER_PAGE_MASK from the pid_namespace.h
      
      Instead of renaming our defines, I chose to define only if not yet
      defined, but to double check the value if already defined.
      Signed-off-by: default avatarPhilipp Reisner <philipp.reisner@linbit.com>
      Signed-off-by: default avatarLars Ellenberg <lars.ellenberg@linbit.com>
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ee6b8876
    • Arnd Bergmann's avatar
      ALSA: ppc/awacs: shut up maybe-uninitialized warning · 938206b8
      Arnd Bergmann authored
      commit b268c34e upstream.
      
      The awacs sound driver produces a false-positive warning in ppc64_defconfig:
      
      sound/ppc/awacs.c: In function 'snd_pmac_awacs_init':
      include/sound/control.h:219:9: warning: 'master_vol' may be used uninitialized in this function [-Wmaybe-uninitialized]
      
      I haven't come up with a good way to rewrite the code to avoid the
      warning, so here is a bad one: I initialize the variable before
      the conditionall initialization so gcc no longer has to worry about
      it.
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      938206b8
    • Takashi Iwai's avatar
      ASoC: intel: Fix PM and non-atomic crash in bytcr drivers · a2b3b19a
      Takashi Iwai authored
      commit 6e4cac23 upstream.
      
      The FE setups of Intel SST bytcr_rt5640 and bytcr_rt5651 drivers carry
      the ignore_suspend flag, and this prevents the suspend/resume working
      properly while the stream is running, since SST core code has the
      check of the running streams and returns -EBUSY.  Drop these
      superfluous flags for fixing the behavior.
      
      Also, the bytcr_rt5640 driver lacks of nonatomic flag in some FE
      definitions, which leads to the kernel Oops at suspend/resume like:
      
        BUG: scheduling while atomic: systemd-sleep/3144/0x00000003
        Call Trace:
         dump_stack+0x5c/0x7a
         __schedule_bug+0x55/0x70
         __schedule+0x63c/0x8c0
         schedule+0x3d/0x90
         schedule_timeout+0x16b/0x320
         ? del_timer_sync+0x50/0x50
         ? sst_wait_timeout+0xa9/0x170 [snd_intel_sst_core]
         ? sst_wait_timeout+0xa9/0x170 [snd_intel_sst_core]
         ? remove_wait_queue+0x60/0x60
         ? sst_prepare_and_post_msg+0x275/0x960 [snd_intel_sst_core]
         ? sst_pause_stream+0x9b/0x110 [snd_intel_sst_core]
         ....
      
      This patch addresses these appropriately, too.
      
      [tiwai: applied only to bytcr_rt5640 as bytcr_rt5651 isn't present in
       4.4.x yet]
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Acked-by: default avatarVinod Koul <vinod.koul@intel.com>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Cc: <stable@vger.kernel.org> # v4.1+
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a2b3b19a
    • Sachin Prabhu's avatar
      Handle mismatched open calls · 6c106b55
      Sachin Prabhu authored
      commit 38bd4906 upstream.
      
      A signal can interrupt a SendReceive call which result in incoming
      responses to the call being ignored. This is a problem for calls such as
      open which results in the successful response being ignored. This
      results in an open file resource on the server.
      
      The patch looks into responses which were cancelled after being sent and
      in case of successful open closes the open fids.
      
      For this patch, the check is only done in SendReceive2()
      
      RH-bz: 1403319
      Signed-off-by: default avatarSachin Prabhu <sprabhu@redhat.com>
      Reviewed-by: default avatarPavel Shilovsky <pshilov@microsoft.com>
      Acked-by: default avatarSachin Prabhu <sprabhu@redhat.com>
      Signed-off-by: default avatarPavel Shilovsky <pshilov@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6c106b55
    • Thomas Gleixner's avatar
      timerfd: Protect the might cancel mechanism proper · 911bd549
      Thomas Gleixner authored
      commit 1e38da30 upstream.
      
      The handling of the might_cancel queueing is not properly protected, so
      parallel operations on the file descriptor can race with each other and
      lead to list corruptions or use after free.
      
      Protect the context for these operations with a seperate lock.
      
      The wait queue lock cannot be reused for this because that would create a
      lock inversion scenario vs. the cancel lock. Replacing might_cancel with an
      atomic (atomic_t or atomic bit) does not help either because it still can
      race vs. the actual list operation.
      Reported-by: default avatarDmitry Vyukov <dvyukov@google.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: "linux-fsdevel@vger.kernel.org"
      Cc: syzkaller <syzkaller@googlegroups.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: linux-fsdevel@vger.kernel.org
      Link: http://lkml.kernel.org/r/alpine.DEB.2.20.1701311521430.3457@nanosSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      911bd549
  2. 03 May, 2017 26 commits