1. 10 Mar, 2019 7 commits
    • Gao Xiang's avatar
      staging: erofs: compressed_pages should not be accessed again after freed · 40245f24
      Gao Xiang authored
      commit af692e11 upstream.
      
      This patch resolves the following page use-after-free issue,
      z_erofs_vle_unzip:
          ...
          for (i = 0; i < nr_pages; ++i) {
              ...
              z_erofs_onlinepage_endio(page);  (1)
          }
      
          for (i = 0; i < clusterpages; ++i) {
              page = compressed_pages[i];
      
              if (page->mapping == mngda)      (2)
                  continue;
              /* recycle all individual staging pages */
              (void)z_erofs_gather_if_stagingpage(page_pool, page); (3)
              WRITE_ONCE(compressed_pages[i], NULL);
          }
          ...
      
      After (1) is executed, page is freed and could be then reused, if
      compressed_pages is scanned after that, it could fall info (2) or
      (3) by mistake and that could finally be in a mess.
      
      This patch aims to solve the above issue only with little changes
      as much as possible in order to make the fix backport easier.
      
      Fixes: 3883a79a ("staging: erofs: introduce VLE decompression support")
      Cc: <stable@vger.kernel.org> # 4.19+
      Signed-off-by: default avatarGao Xiang <gaoxiang25@huawei.com>
      Reviewed-by: default avatarChao Yu <yuchao0@huawei.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      40245f24
    • Gao Xiang's avatar
      staging: erofs: fix illegal address access under memory pressure · 1fa7c9b4
      Gao Xiang authored
      commit 1e5ceeab upstream.
      
      Considering a read request with two decompressed file pages,
      If a decompression work cannot be started on the previous page
      due to memory pressure but in-memory LTP map lookup is done,
      builder->work should be still NULL.
      
      Moreover, if the current page also belongs to the same map,
      it won't try to start the decompression work again and then
      run into trouble.
      
      This patch aims to solve the above issue only with little changes
      as much as possible in order to make the fix backport easier.
      
      kernel message is:
      <4>[1051408f.015930s]SLUB: Unable to allocate memory on node -1, gfp=0x2408040(GFP_NOFS|__GFP_ZERO)
      <4>[1051408f.015930s]  cache: erofs_compress, object size: 144, buffer size: 144, default order: 0, min order: 0
      <4>[1051408f.015930s]  node 0: slabs: 98, objs: 2744, free: 0
        * Cannot allocate the decompression work
      
      <3>[1051408f.015960s]erofs: z_erofs_vle_normalaccess_readpages, readahead error at page 1008 of nid 5391488
        * Note that the previous page was failed to read
      
      <0>[1051408f.015960s]Internal error: Accessing user space memory outside uaccess.h routines: 96000005 [#1] PREEMPT SMP
      ...
      <4>[1051408f.015991s]Hardware name: kirin710 (DT)
      ...
      <4>[1051408f.016021s]PC is at z_erofs_vle_work_add_page+0xa0/0x17c
      <4>[1051408f.016021s]LR is at z_erofs_do_read_page+0x12c/0xcf0
      ...
      <4>[1051408f.018096s][<ffffff80c6fb0fd4>] z_erofs_vle_work_add_page+0xa0/0x17c
      <4>[1051408f.018096s][<ffffff80c6fb3814>] z_erofs_vle_normalaccess_readpages+0x1a0/0x37c
      <4>[1051408f.018096s][<ffffff80c6d670b8>] read_pages+0x70/0x190
      <4>[1051408f.018127s][<ffffff80c6d6736c>] __do_page_cache_readahead+0x194/0x1a8
      <4>[1051408f.018127s][<ffffff80c6d59318>] filemap_fault+0x398/0x684
      <4>[1051408f.018127s][<ffffff80c6d8a9e0>] __do_fault+0x8c/0x138
      <4>[1051408f.018127s][<ffffff80c6d8f90c>] handle_pte_fault+0x730/0xb7c
      <4>[1051408f.018127s][<ffffff80c6d8fe04>] __handle_mm_fault+0xac/0xf4
      <4>[1051408f.018157s][<ffffff80c6d8fec8>] handle_mm_fault+0x7c/0x118
      <4>[1051408f.018157s][<ffffff80c8c52998>] do_page_fault+0x354/0x474
      <4>[1051408f.018157s][<ffffff80c8c52af8>] do_translation_fault+0x40/0x48
      <4>[1051408f.018157s][<ffffff80c6c002f4>] do_mem_abort+0x80/0x100
      <4>[1051408f.018310s]---[ end trace 9f4009a3283bd78b ]---
      
      Fixes: 3883a79a ("staging: erofs: introduce VLE decompression support")
      Cc: <stable@vger.kernel.org> # 4.19+
      Signed-off-by: default avatarGao Xiang <gaoxiang25@huawei.com>
      Reviewed-by: default avatarChao Yu <yuchao0@huawei.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1fa7c9b4
    • Mans Rullgard's avatar
      USB: serial: ftdi_sio: add ID for Hjelmslund Electronics USB485 · b46e1fc6
      Mans Rullgard authored
      commit 8d7fa3d4 upstream.
      
      This adds the USB ID of the Hjelmslund Electronics USB485 Iso stick.
      Signed-off-by: default avatarMans Rullgard <mans@mansr.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b46e1fc6
    • Ivan Mironov's avatar
      USB: serial: cp210x: add ID for Ingenico 3070 · da20be99
      Ivan Mironov authored
      commit dd9d3d86 upstream.
      
      Here is how this device appears in kernel log:
      
      	usb 3-1: new full-speed USB device number 18 using xhci_hcd
      	usb 3-1: New USB device found, idVendor=0b00, idProduct=3070
      	usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
      	usb 3-1: Product: Ingenico 3070
      	usb 3-1: Manufacturer: Silicon Labs
      	usb 3-1: SerialNumber: 0001
      
      Apparently this is a POS terminal with embedded USB-to-Serial converter.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarIvan Mironov <mironov.ivan@gmail.com>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      da20be99
    • Daniele Palmas's avatar
      USB: serial: option: add Telit ME910 ECM composition · 965e7160
      Daniele Palmas authored
      commit 6431866b upstream.
      
      This patch adds Telit ME910 family ECM composition 0x1102.
      Signed-off-by: default avatarDaniele Palmas <dnlplm@gmail.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      965e7160
    • Gao Xiang's avatar
      staging: erofs: fix mis-acted TAIL merging behavior · cbace523
      Gao Xiang authored
      commit a112152f upstream.
      
      EROFS has an optimized path called TAIL merging, which is designed
      to merge multiple reads and the corresponding decompressions into
      one if these requests read continuous pages almost at the same time.
      
      In general, it behaves as follows:
       ________________________________________________________________
        ... |  TAIL  .  HEAD  |  PAGE  |  PAGE  |  TAIL    . HEAD | ...
       _____|_combined page A_|________|________|_combined page B_|____
              1  ]  ->  [  2                          ]  ->  [ 3
      If the above three reads are requested in the order 1-2-3, it will
      generate a large work chain rather than 3 individual work chains
      to reduce scheduling overhead and boost up sequential read.
      
      However, if Read 2 is processed slightly earlier than Read 1,
      currently it still generates 2 individual work chains (chain 1, 2)
      but it does in-place decompression for combined page A, moreover,
      if chain 2 decompresses ahead of chain 1, it will be a race and
      lead to corrupted decompressed page. This patch fixes it.
      
      Fixes: 3883a79a ("staging: erofs: introduce VLE decompression support")
      Cc: <stable@vger.kernel.org> # 4.19+
      Signed-off-by: default avatarGao Xiang <gaoxiang25@huawei.com>
      Reviewed-by: default avatarChao Yu <yuchao0@huawei.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      cbace523
    • Viresh Kumar's avatar
      cpufreq: Use struct kobj_attribute instead of struct global_attr · 464b4279
      Viresh Kumar authored
      commit 625c85a6 upstream.
      
      The cpufreq_global_kobject is created using kobject_create_and_add()
      helper, which assigns the kobj_type as dynamic_kobj_ktype and show/store
      routines are set to kobj_attr_show() and kobj_attr_store().
      
      These routines pass struct kobj_attribute as an argument to the
      show/store callbacks. But all the cpufreq files created using the
      cpufreq_global_kobject expect the argument to be of type struct
      attribute. Things work fine currently as no one accesses the "attr"
      argument. We may not see issues even if the argument is used, as struct
      kobj_attribute has struct attribute as its first element and so they
      will both get same address.
      
      But this is logically incorrect and we should rather use struct
      kobj_attribute instead of struct global_attr in the cpufreq core and
      drivers and the show/store callbacks should take struct kobj_attribute
      as argument instead.
      
      This bug is caught using CFI CLANG builds in android kernel which
      catches mismatch in function prototypes for such callbacks.
      Reported-by: default avatarDonghee Han <dh.han@samsung.com>
      Reported-by: default avatarSangkyu Kim <skwith.kim@samsung.com>
      Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      464b4279
  2. 05 Mar, 2019 33 commits