1. 01 8月, 2018 6 次提交
  2. 03 7月, 2018 1 次提交
  3. 22 6月, 2018 1 次提交
  4. 07 6月, 2018 1 次提交
    • K
      treewide: Use struct_size() for devm_kmalloc() and friends · 0ed2dd03
      Kees Cook 提交于
      Replaces open-coded struct size calculations with struct_size() for
      devm_*, f2fs_*, and sock_* allocations. Automatically generated (and
      manually adjusted) from the following Coccinelle script:
      
      // Direct reference to struct field.
      @@
      identifier alloc =~ "devm_kmalloc|devm_kzalloc|sock_kmalloc|f2fs_kmalloc|f2fs_kzalloc";
      expression HANDLE;
      expression GFP;
      identifier VAR, ELEMENT;
      expression COUNT;
      @@
      
      - alloc(HANDLE, sizeof(*VAR) + COUNT * sizeof(*VAR->ELEMENT), GFP)
      + alloc(HANDLE, struct_size(VAR, ELEMENT, COUNT), GFP)
      
      // mr = kzalloc(sizeof(*mr) + m * sizeof(mr->map[0]), GFP_KERNEL);
      @@
      identifier alloc =~ "devm_kmalloc|devm_kzalloc|sock_kmalloc|f2fs_kmalloc|f2fs_kzalloc";
      expression HANDLE;
      expression GFP;
      identifier VAR, ELEMENT;
      expression COUNT;
      @@
      
      - alloc(HANDLE, sizeof(*VAR) + COUNT * sizeof(VAR->ELEMENT[0]), GFP)
      + alloc(HANDLE, struct_size(VAR, ELEMENT, COUNT), GFP)
      
      // Same pattern, but can't trivially locate the trailing element name,
      // or variable name.
      @@
      identifier alloc =~ "devm_kmalloc|devm_kzalloc|sock_kmalloc|f2fs_kmalloc|f2fs_kzalloc";
      expression HANDLE;
      expression GFP;
      expression SOMETHING, COUNT, ELEMENT;
      @@
      
      - alloc(HANDLE, sizeof(SOMETHING) + COUNT * sizeof(ELEMENT), GFP)
      + alloc(HANDLE, CHECKME_struct_size(&SOMETHING, ELEMENT, COUNT), GFP)
      Signed-off-by: NKees Cook <keescook@chromium.org>
      0ed2dd03
  5. 18 5月, 2018 9 次提交
  6. 24 4月, 2018 1 次提交
    • T
      mtd: spi-nor: cadence-quadspi: Fix page fault kernel panic · 47016b34
      Thor Thayer 提交于
      The current Cadence QSPI driver caused a kernel panic when loading
      a Root Filesystem from QSPI. The problem was caused by reading more
      bytes than needed because the QSPI operated on 4 bytes at a time.
      <snip>
      [    7.947754] spi_nor_read[1048]:from 0x037cad74, len 1 [bfe07fff]
      [    7.956247] cqspi_read[910]:offset 0x58502516, buffer=bfe07fff
      [    7.956247]
      [    7.966046] Unable to handle kernel paging request at virtual
      address bfe08002
      [    7.973239] pgd = eebfc000
      [    7.975931] [bfe08002] *pgd=2fffb811, *pte=00000000, *ppte=00000000
      </snip>
      Notice above how only 1 byte needed to be read but by reading 4 bytes
      into the end of a mapped page, an unrecoverable page fault occurred.
      
      This patch uses a temporary buffer to hold the 4 bytes read and then
      copies only the bytes required into the buffer. A min() function is
      used to limit the length to prevent buffer overflows.
      
      Request testing of this patch on other platforms. This was tested
      on the Intel Arria10 SoCFPGA DevKit.
      
      Fixes: 0cf17256 ("mtd: spi-nor: cqspi: Fix build on arches missing readsl/writesl")
      Signed-off-by: NThor Thayer <thor.thayer@linux.intel.com>
      Cc: <stable@vger.kernel.org>
      Reviewed-by: NMarek Vasut <marek.vasut@gmail.com>
      Signed-off-by: NBoris Brezillon <boris.brezillon@bootlin.com>
      47016b34
  7. 21 4月, 2018 7 次提交
  8. 30 3月, 2018 1 次提交
  9. 29 3月, 2018 1 次提交
  10. 21 3月, 2018 1 次提交
  11. 14 1月, 2018 1 次提交
  12. 08 1月, 2018 4 次提交
  13. 28 12月, 2017 2 次提交
  14. 20 12月, 2017 2 次提交
  15. 13 12月, 2017 2 次提交