1. 22 Mar, 2018 32 commits
  2. 18 Mar, 2018 8 commits
    • Greg Kroah-Hartman's avatar
      Linux 4.9.88 · 46e076f0
      Greg Kroah-Hartman authored
      46e076f0
    • Koen Vandeputte's avatar
      PCI: dwc: Fix enumeration end when reaching root subordinate · 0e2bc507
      Koen Vandeputte authored
      commit fc110ebd upstream.
      
      The subordinate value indicates the highest bus number which can be
      reached downstream though a certain device.
      
      Commit a20c7f36 ("PCI: Do not allocate more buses than available in
      parent") ensures that downstream devices cannot assign busnumbers higher
      than the upstream device subordinate number, which was indeed illogical.
      
      By default, dw_pcie_setup_rc() inits the Root Complex subordinate to a
      value of 0x01.
      
      Due to this combined with above commit, enumeration stops digging deeper
      downstream as soon as bus num 0x01 has been assigned, which is always the
      case for a bridge device.
      
      This results in all devices behind a bridge bus remaining undetected, as
      these would be connected to bus 0x02 or higher.
      
      Fix this by initializing the RC to a subordinate value of 0xff, which is
      not altering hardware behaviour in any way, but informs probing function
      pci_scan_bridge() later on which reads this value back from register.
      
      The following nasty errors during boot are also fixed by this:
      
        pci_bus 0000:02: busn_res: can not insert [bus 02-ff] under [bus 01] (conflicts with (null) [bus 01])
        ...
        pci_bus 0000:03: [bus 03] partially hidden behind bridge 0000:01 [bus 01]
        ...
        pci_bus 0000:04: [bus 04] partially hidden behind bridge 0000:01 [bus 01]
        ...
        pci_bus 0000:05: [bus 05] partially hidden behind bridge 0000:01 [bus 01]
        pci_bus 0000:02: busn_res: [bus 02-ff] end is updated to 05
        pci_bus 0000:02: busn_res: can not insert [bus 02-05] under [bus 01] (conflicts with (null) [bus 01])
        pci_bus 0000:02: [bus 02-05] partially hidden behind bridge 0000:01 [bus 01]
      
      Fixes: a20c7f36 ("PCI: Do not allocate more buses than available in
      parent")
      Tested-by: default avatarNiklas Cassel <niklas.cassel@axis.com>
      Tested-by: default avatarFabio Estevam <fabio.estevam@nxp.com>
      Tested-by: default avatarSebastian Reichel <sebastian.reichel@collabora.co.uk>
      Signed-off-by: default avatarKoen Vandeputte <koen.vandeputte@ncentric.com>
      Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
      Acked-by: default avatarLucas Stach <l.stach@pengutronix.de>
      Cc: stable@vger.kernel.org	# v4.15+
      Cc: Binghui Wang <wangbinghui@hisilicon.com>
      Cc: Jesper Nilsson <jesper.nilsson@axis.com>
      Cc: Jianguo Sun <sunjianguo1@huawei.com>
      Cc: Jingoo Han <jingoohan1@gmail.com>
      Cc: Kishon Vijay Abraham I <kishon@ti.com>
      Cc: Lucas Stach <l.stach@pengutronix.de>
      Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
      Cc: Minghuan Lian <minghuan.Lian@freescale.com>
      Cc: Mingkai Hu <mingkai.hu@freescale.com>
      Cc: Murali Karicheri <m-karicheri2@ti.com>
      Cc: Pratyush Anand <pratyush.anand@gmail.com>
      Cc: Richard Zhu <hongxing.zhu@nxp.com>
      Cc: Roy Zang <tie-fei.zang@freescale.com>
      Cc: Shawn Guo <shawn.guo@linaro.org>
      Cc: Stanimir Varbanov <svarbanov@mm-sol.com>
      Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Cc: Xiaowei Song <songxiaowei@hisilicon.com>
      Cc: Zhou Wang <wangzhou1@hisilicon.com>
      [fabio: adapted to the file location of 4.9 kernel]
      Signed-off-by: default avatarFabio Estevam <fabio.estevam@nxp.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0e2bc507
    • Greentime Hu's avatar
      earlycon: add reg-offset to physical address before mapping · bd0d6730
      Greentime Hu authored
      commit 1f66dd36 upstream.
      
      It will get the wrong virtual address because port->mapbase is not added
      the correct reg-offset yet. We have to update it before earlycon_map()
      is called
      Signed-off-by: default avatarGreentime Hu <greentime@andestech.com>
      Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
      Cc: Peter Hurley <peter@hurleysoftware.com>
      Cc: stable@vger.kernel.org
      Fixes: 088da2a1 ("of: earlycon: Initialize port fields from DT properties")
      Acked-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bd0d6730
    • Sebastian Andrzej Siewior's avatar
      serial: core: mark port as initialized in autoconfig · fbe1ad97
      Sebastian Andrzej Siewior authored
      commit 71456906 upstream.
      
      This is a followup on 44117a1d ("serial: core: mark port as
      initialized after successful IRQ change").
      Nikola has been using autoconfig via setserial and reported a crash
      similar to what I fixed in the earlier mentioned commit. Here I do the
      same fixup for the autoconfig. I wasn't sure that this is the right
      approach. Nikola confirmed that it fixes his crash.
      
      Fixes: b3b57646 ("tty: serial_core: convert uart_open to use tty_port_open")
      Link: http://lkml.kernel.org/r/20180131072000.GD1853@localhost.localdomainReported-by: default avatarNikola Ciprich <nikola.ciprich@linuxbox.cz>
      Tested-by: default avatarNikola Ciprich <nikola.ciprich@linuxbox.cz>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Tested-by: default avatarNikola Ciprich <nikola.ciprich@linuxbox.cz>
      Acked-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fbe1ad97
    • Nikola Ciprich's avatar
      serial: 8250_pci: Add Brainboxes UC-260 4 port serial device · 46d16d6e
      Nikola Ciprich authored
      commit 9f2068f3 upstream.
      
      Add PCI ids for two variants of Brainboxes UC-260 quad port
      PCI serial cards.
      Suggested-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: default avatarNikola Ciprich <nikola.ciprich@linuxbox.cz>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      46d16d6e
    • Xinyong's avatar
      usb: gadget: f_fs: Fix use-after-free in ffs_fs_kill_sb() · dddf4650
      Xinyong authored
      commit 1a087f03 upstream.
      
      When I debug a kernel crash issue in funcitonfs, found ffs_data.ref
      overflowed, While functionfs is unmounting, ffs_data is put twice.
      
      Commit 43938613 ("drivers, usb: convert ffs_data.ref from atomic_t to
      refcount_t") can avoid refcount overflow, but that is risk some situations.
      So no need put ffs data in ffs_fs_kill_sb, already put in ffs_data_closed.
      
      The issue can be reproduced in Mediatek mt6763 SoC, ffs for ADB device.
      KASAN enabled configuration reports use-after-free errro.
      
      BUG: KASAN: use-after-free in refcount_dec_and_test+0x14/0xe0 at addr ffffffc0579386a0
      Read of size 4 by task umount/4650
      ====================================================
      BUG kmalloc-512 (Tainted: P        W  O   ): kasan: bad access detected
      -----------------------------------------------------------------------------
      
      INFO: Allocated in ffs_fs_mount+0x194/0x844 age=22856 cpu=2 pid=566
          alloc_debug_processing+0x1ac/0x1e8
          ___slab_alloc.constprop.63+0x640/0x648
          __slab_alloc.isra.57.constprop.62+0x24/0x34
          kmem_cache_alloc_trace+0x1a8/0x2bc
          ffs_fs_mount+0x194/0x844
          mount_fs+0x6c/0x1d0
          vfs_kern_mount+0x50/0x1b4
          do_mount+0x258/0x1034
      INFO: Freed in ffs_data_put+0x25c/0x320 age=0 cpu=3 pid=4650
          free_debug_processing+0x22c/0x434
          __slab_free+0x2d8/0x3a0
          kfree+0x254/0x264
          ffs_data_put+0x25c/0x320
          ffs_data_closed+0x124/0x15c
          ffs_fs_kill_sb+0xb8/0x110
          deactivate_locked_super+0x6c/0x98
          deactivate_super+0xb0/0xbc
      INFO: Object 0xffffffc057938600 @offset=1536 fp=0x          (null)
      ......
      Call trace:
      [<ffffff900808cf5c>] dump_backtrace+0x0/0x250
      [<ffffff900808d3a0>] show_stack+0x14/0x1c
      [<ffffff90084a8c04>] dump_stack+0xa0/0xc8
      [<ffffff900826c2b4>] print_trailer+0x158/0x260
      [<ffffff900826d9d8>] object_err+0x3c/0x40
      [<ffffff90082745f0>] kasan_report_error+0x2a8/0x754
      [<ffffff9008274f84>] kasan_report+0x5c/0x60
      [<ffffff9008273208>] __asan_load4+0x70/0x88
      [<ffffff90084cd81c>] refcount_dec_and_test+0x14/0xe0
      [<ffffff9008d98f9c>] ffs_data_put+0x80/0x320
      [<ffffff9008d9d904>] ffs_fs_kill_sb+0xc8/0x110
      [<ffffff90082852a0>] deactivate_locked_super+0x6c/0x98
      [<ffffff900828537c>] deactivate_super+0xb0/0xbc
      [<ffffff90082af0c0>] cleanup_mnt+0x64/0xec
      [<ffffff90082af1b0>] __cleanup_mnt+0x10/0x18
      [<ffffff90080d9e68>] task_work_run+0xcc/0x124
      [<ffffff900808c8c0>] do_notify_resume+0x60/0x70
      [<ffffff90080866e4>] work_pending+0x10/0x14
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarXinyong <xinyong.fang@linux.alibaba.com>
      Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      dddf4650
    • Pete Zaitcev's avatar
      usb: usbmon: Read text within supplied buffer size · 63f3bac3
      Pete Zaitcev authored
      commit a5f59683 upstream.
      
      This change fixes buffer overflows and silent data corruption with the
      usbmon device driver text file read operations.
      Signed-off-by: default avatarFredrik Noring <noring@nocrew.org>
      Signed-off-by: default avatarPete Zaitcev <zaitcev@redhat.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      63f3bac3
    • Danilo Krummrich's avatar
      usb: quirks: add control message delay for 1b1c:1b20 · b2708e1e
      Danilo Krummrich authored
      commit cb88a058 upstream.
      
      Corsair Strafe RGB keyboard does not respond to usb control messages
      sometimes and hence generates timeouts.
      
      Commit de3af5bf ("usb: quirks: add delay init quirk for Corsair
      Strafe RGB keyboard") tried to fix those timeouts by adding
      USB_QUIRK_DELAY_INIT.
      
      Unfortunately, even with this quirk timeouts of usb_control_msg()
      can still be seen, but with a lower frequency (approx. 1 out of 15):
      
      [   29.103520] usb 1-8: string descriptor 0 read error: -110
      [   34.363097] usb 1-8: can't set config #1, error -110
      
      Adding further delays to different locations where usb control
      messages are issued just moves the timeouts to other locations,
      e.g.:
      
      [   35.400533] usbhid 1-8:1.0: can't add hid device: -110
      [   35.401014] usbhid: probe of 1-8:1.0 failed with error -110
      
      The only way to reliably avoid those issues is having a pause after
      each usb control message. In approx. 200 boot cycles no more timeouts
      were seen.
      
      Addionaly, keep USB_QUIRK_DELAY_INIT as it turned out to be necessary
      to have the delay in hub_port_connect() after hub_port_init().
      
      The overall boot time seems not to be influenced by these additional
      delays, even on fast machines and lightweight distributions.
      
      Fixes: de3af5bf ("usb: quirks: add delay init quirk for Corsair Strafe RGB keyboard")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarDanilo Krummrich <danilokrummrich@dk-develop.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b2708e1e