1. 17 May, 2017 32 commits
  2. 16 May, 2017 8 commits
    • Alexandre Belloni's avatar
      ARM: dts: at91: Enable DMA on sama5d4_xplained console · 57389faf
      Alexandre Belloni authored
      [ Upstream commit ef8d02d4 ]
      
      Enable DMA on usart3 to get a more reliable console. This is especially
      useful for automation and kernelci were a kernel with PROVE_LOCKING enabled
      is quite susceptible to character loss, resulting in tests failure.
      
      Cc: stable <stable@vger.kernel.org> #v4.1+
      Acked-by: default avatarNicolas Ferre <nicolas.ferre@atmel.com>
      Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@free-electrons.com>
      Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
      57389faf
    • Arnd Bergmann's avatar
      staging: rtl: fix possible NULL pointer dereference · 61b067fb
      Arnd Bergmann authored
      [ Upstream commit 6e017006 ]
      
      gcc-7 detects that wlanhdr_to_ethhdr() in two drivers calls memcpy() with
      a destination argument that an earlier function call may have set to NULL:
      
      staging/rtl8188eu/core/rtw_recv.c: In function 'wlanhdr_to_ethhdr':
      staging/rtl8188eu/core/rtw_recv.c:1318:2: warning: argument 1 null where non-null expected [-Wnonnull]
      staging/rtl8712/rtl871x_recv.c: In function 'r8712_wlanhdr_to_ethhdr':
      staging/rtl8712/rtl871x_recv.c:649:2: warning: argument 1 null where non-null expected [-Wnonnull]
      
      I'm fixing this by adding a NULL pointer check and returning failure
      from the function, which is hopefully already handled properly.
      
      This seems to date back to when the drivers were originally added,
      so backporting the fix to stable seems appropriate. There are other
      related realtek drivers in the kernel, but none of them contain a
      function with a similar name or produce this warning.
      
      Cc: stable@vger.kernel.org
      Fixes: 1cc18a22 ("staging: r8188eu: Add files for new driver - part 5")
      Fixes: 2865d42c ("staging: r8712u: Add the new driver to the mainline kernel")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
      61b067fb
    • Johan Hovold's avatar
      USB: serial: opticon: fix CTS retrieval at open · 434c09af
      Johan Hovold authored
      [ Upstream commit 2eee0502 ]
      
      The opticon driver used a control request at open to trigger a CTS
      status notification to be sent over the bulk-in pipe. When the driver
      was converted to using the generic read implementation, an inverted test
      prevented this request from being sent, something which could lead to
      TIOCMGET reporting an incorrect CTS state.
      Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Fixes: 7a6ee2b0 ("USB: opticon: switch to generic read
      implementation")
      Cc: stable <stable@vger.kernel.org>
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
      434c09af
    • Johan Hovold's avatar
      USB: serial: spcp8x5: fix modem-status handling · 700b2315
      Johan Hovold authored
      [ Upstream commit 5ed8d410 ]
      
      Make sure to detect short control transfers and return zero on success
      when retrieving the modem status.
      
      This fixes the TIOCMGET implementation which since e1ed212d ("USB:
      spcp8x5: add proper modem-status support") has returned TIOCM_LE on
      successful retrieval, and avoids leaking bits from the stack on short
      transfers.
      
      This also fixes the carrier-detect implementation which since the above
      mentioned commit unconditionally has returned true.
      
      Fixes: e1ed212d ("USB: spcp8x5: add proper modem-status support")
      Cc: stable <stable@vger.kernel.org>
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
      700b2315
    • Johan Hovold's avatar
      USB: serial: ftdi_sio: fix modem-status error handling · da3a3bec
      Johan Hovold authored
      [ Upstream commit 427c3a95 ]
      
      Make sure to detect short responses when fetching the modem status in
      order to avoid parsing uninitialised buffer data and having bits of it
      leak to user space.
      
      Note that we still allow for short 1-byte responses.
      
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Cc: stable <stable@vger.kernel.org>
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
      da3a3bec
    • Johan Hovold's avatar
      USB: serial: ark3116: fix register-accessor error handling · 270ffbd1
      Johan Hovold authored
      [ Upstream commit 9fef37d7 ]
      
      The current implementation failed to detect short transfers, something
      which could lead to bits of the uninitialised heap transfer buffer
      leaking to user space.
      
      Fixes: 149fc791 ("USB: ark3116: Setup some basic infrastructure for
      new ark3116 driver.")
      Fixes: f4c1e8d5 ("USB: ark3116: Make existing functions 16450-aware
      and add close and release functions.")
      Cc: stable <stable@vger.kernel.org>
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
      270ffbd1
    • Feras Daoud's avatar
      IB/ipoib: Fix deadlock between rmmod and set_mode · 131d8169
      Feras Daoud authored
      [ Upstream commit 0a0007f2 ]
      
      When calling set_mode from sys/fs, the call flow locks the sys/fs lock
      first and then tries to lock rtnl_lock (when calling ipoib_set_mod).
      On the other hand, the rmmod call flow takes the rtnl_lock first
      (when calling unregister_netdev) and then tries to take the sys/fs
      lock. Deadlock a->b, b->a.
      
      The problem starts when ipoib_set_mod frees it's rtnl_lck and tries
      to get it after that.
      
          set_mod:
          [<ffffffff8104f2bd>] ? check_preempt_curr+0x6d/0x90
          [<ffffffff814fee8e>] __mutex_lock_slowpath+0x13e/0x180
          [<ffffffff81448655>] ? __rtnl_unlock+0x15/0x20
          [<ffffffff814fed2b>] mutex_lock+0x2b/0x50
          [<ffffffff81448675>] rtnl_lock+0x15/0x20
          [<ffffffffa02ad807>] ipoib_set_mode+0x97/0x160 [ib_ipoib]
          [<ffffffffa02b5f5b>] set_mode+0x3b/0x80 [ib_ipoib]
          [<ffffffff8134b840>] dev_attr_store+0x20/0x30
          [<ffffffff811f0fe5>] sysfs_write_file+0xe5/0x170
          [<ffffffff8117b068>] vfs_write+0xb8/0x1a0
          [<ffffffff8117ba81>] sys_write+0x51/0x90
          [<ffffffff8100b0f2>] system_call_fastpath+0x16/0x1b
      
          rmmod:
          [<ffffffff81279ffc>] ? put_dec+0x10c/0x110
          [<ffffffff8127a2ee>] ? number+0x2ee/0x320
          [<ffffffff814fe6a5>] schedule_timeout+0x215/0x2e0
          [<ffffffff8127cc04>] ? vsnprintf+0x484/0x5f0
          [<ffffffff8127b550>] ? string+0x40/0x100
          [<ffffffff814fe323>] wait_for_common+0x123/0x180
          [<ffffffff81060250>] ? default_wake_function+0x0/0x20
          [<ffffffff8119661e>] ? ifind_fast+0x5e/0xb0
          [<ffffffff814fe43d>] wait_for_completion+0x1d/0x20
          [<ffffffff811f2e68>] sysfs_addrm_finish+0x228/0x270
          [<ffffffff811f2fb3>] sysfs_remove_dir+0xa3/0xf0
          [<ffffffff81273f66>] kobject_del+0x16/0x40
          [<ffffffff8134cd14>] device_del+0x184/0x1e0
          [<ffffffff8144e59b>] netdev_unregister_kobject+0xab/0xc0
          [<ffffffff8143c05e>] rollback_registered+0xae/0x130
          [<ffffffff8143c102>] unregister_netdevice+0x22/0x70
          [<ffffffff8143c16e>] unregister_netdev+0x1e/0x30
          [<ffffffffa02a91b0>] ipoib_remove_one+0xe0/0x120 [ib_ipoib]
          [<ffffffffa01ed95f>] ib_unregister_device+0x4f/0x100 [ib_core]
          [<ffffffffa021f5e1>] mlx4_ib_remove+0x41/0x180 [mlx4_ib]
          [<ffffffffa01ab771>] mlx4_remove_device+0x71/0x90 [mlx4_core]
      
      Fixes: 862096a8 ("IB/ipoib: Add more rtnl_link_ops callbacks")
      Cc: <stable@vger.kernel.org> # v3.6+
      Cc: Or Gerlitz <ogerlitz@mellanox.com>
      Signed-off-by: default avatarFeras Daoud <ferasda@mellanox.com>
      Signed-off-by: default avatarErez Shitrit <erezsh@mellanox.com>
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
      Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
      131d8169
    • Jason Gunthorpe's avatar
      RDMA/core: Fix incorrect structure packing for booleans · 24104f6a
      Jason Gunthorpe authored
      [ Upstream commit 55efcfcd ]
      
      The RDMA core uses ib_pack() to convert from unpacked CPU structs
      to on-the-wire bitpacked structs.
      
      This process requires that 1 bit fields are declared as u8 in the
      unpacked struct, otherwise the packing process does not read the
      value properly and the packed result is wired to 0. Several
      places wrongly used int.
      
      Crucially this means the kernel has never, set reversible
      correctly in the path record request. It has always asked for
      irreversible paths even if the ULP requests otherwise.
      
      When the kernel is used with a SM that supports this feature, it
      completely breaks communication management if reversible paths are
      not properly requested.
      
      The only reason this ever worked is because opensm ignores the
      reversible bit.
      
      Cc: stable@vger.kernel.org
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Signed-off-by: default avatarJason Gunthorpe <jgunthorpe@obsidianresearch.com>
      Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
      Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
      24104f6a