1. 29 12月, 2020 4 次提交
  2. 28 12月, 2020 1 次提交
  3. 16 12月, 2020 1 次提交
    • B
      edac: ghes: use krealloc_array() · af11be05
      Bartosz Golaszewski 提交于
      Use the helper that checks for overflows internally instead of manually
      calculating the size of the new array.
      
      Link: https://lkml.kernel.org/r/20201109110654.12547-7-brgl@bgdev.plSigned-off-by: NBartosz Golaszewski <bgolaszewski@baylibre.com>
      Acked-by: NBorislav Petkov <bp@suse.de>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Christian Knig <christian.koenig@amd.com>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Daniel Vetter <daniel@ffwll.ch>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: David Airlie <airlied@linux.ie>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Gustavo Padovan <gustavo@padovan.org>
      Cc: James Morse <james.morse@arm.com>
      Cc: Jaroslav Kysela <perex@perex.cz>
      Cc: Jason Wang <jasowang@redhat.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Cc: Linus Walleij <linus.walleij@linaro.org>
      Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
      Cc: Maxime Ripard <mripard@kernel.org>
      Cc: "Michael S . Tsirkin" <mst@redhat.com>
      Cc: Pekka Enberg <penberg@kernel.org>
      Cc: Robert Richter <rric@kernel.org>
      Cc: Sumit Semwal <sumit.semwal@linaro.org>
      Cc: Takashi Iwai <tiwai@suse.com>
      Cc: Takashi Iwai <tiwai@suse.de>
      Cc: Thomas Zimmermann <tzimmermann@suse.de>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      af11be05
  4. 07 12月, 2020 2 次提交
  5. 27 11月, 2020 1 次提交
    • B
      EDAC/amd64: Fix PCI component registration · 706657b1
      Borislav Petkov 提交于
      In order to setup its PCI component, the driver needs any node private
      instance in order to get a reference to the PCI device and hand that
      into edac_pci_create_generic_ctl(). For convenience, it uses the 0th
      memory controller descriptor under the assumption that if any, the 0th
      will be always present.
      
      However, this assumption goes wrong when the 0th node doesn't have
      memory and the driver doesn't initialize an instance for it:
      
        EDAC amd64: F17h detected (node 0).
        ...
        EDAC amd64: Node 0: No DIMMs detected.
      
      But looking up node instances is not really needed - all one needs is
      the pointer to the proper device which gets discovered during instance
      init.
      
      So stash that pointer into a variable and use it when setting up the
      EDAC PCI component.
      
      Clear that variable when the driver needs to unwind due to some
      instances failing init to avoid any registration imbalance.
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Link: https://lkml.kernel.org/r/20201122150815.13808-1-bp@alien8.de
      706657b1
  6. 24 11月, 2020 1 次提交
  7. 20 11月, 2020 5 次提交
  8. 19 11月, 2020 3 次提交
  9. 06 11月, 2020 1 次提交
  10. 03 11月, 2020 1 次提交
  11. 26 10月, 2020 2 次提交
  12. 10 10月, 2020 1 次提交
  13. 18 9月, 2020 2 次提交
  14. 17 9月, 2020 2 次提交
  15. 15 9月, 2020 2 次提交
    • B
      EDAC/ghes: Check whether the driver is on the safe list correctly · 251c54ea
      Borislav Petkov 提交于
      With CONFIG_DEBUG_TEST_DRIVER_REMOVE=y, a system would try to probe,
      unregister and probe again a driver.
      
      When ghes_edac is attempted to be loaded on a system which is not on
      the safe platforms list, ghes_edac_register() would return early. The
      unregister counterpart ghes_edac_unregister() would still attempt to
      unregister and exit early at the refcount test, leading to the refcount
      underflow below.
      
      In order to not do *anything* on the unregister path too, reuse the
      force_load parameter and check it on that path too, before fumbling with
      the refcount.
      
        ghes_edac: ghes_edac_register: entry
        ghes_edac: ghes_edac_register: return -ENODEV
        ------------[ cut here ]------------
        refcount_t: underflow; use-after-free.
        WARNING: CPU: 10 PID: 1 at lib/refcount.c:28 refcount_warn_saturate+0xb9/0x100
        Modules linked in:
        CPU: 10 PID: 1 Comm: swapper/0 Not tainted 5.9.0-rc4+ #12
        Hardware name: GIGABYTE MZ01-CE1-00/MZ01-CE1-00, BIOS F02 08/29/2018
        RIP: 0010:refcount_warn_saturate+0xb9/0x100
        Code: 82 e8 fb 8f 4d 00 90 0f 0b 90 90 c3 80 3d 55 4c f5 00 00 75 88 c6 05 4c 4c f5 00 01 90 48 c7 c7 d0 8a 10 82 e8 d8 8f 4d 00 90 <0f> 0b 90 90 c3 80 3d 30 4c f5 00 00 0f 85 61 ff ff ff c6 05 23 4c
        RSP: 0018:ffffc90000037d58 EFLAGS: 00010292
        RAX: 0000000000000026 RBX: ffff88840b8da000 RCX: 0000000000000000
        RDX: 0000000000000001 RSI: ffffffff8216b24f RDI: 00000000ffffffff
        RBP: ffff88840c662e00 R08: 0000000000000001 R09: 0000000000000001
        R10: 0000000000000001 R11: 0000000000000046 R12: 0000000000000000
        R13: 0000000000000001 R14: 0000000000000000 R15: 0000000000000000
        FS:  0000000000000000(0000) GS:ffff88840ee80000(0000) knlGS:0000000000000000
        CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
        CR2: 0000000000000000 CR3: 0000800002211000 CR4: 00000000003506e0
        Call Trace:
         ghes_edac_unregister
         ghes_remove
         platform_drv_remove
         really_probe
         driver_probe_device
         device_driver_attach
         __driver_attach
         ? device_driver_attach
         ? device_driver_attach
         bus_for_each_dev
         bus_add_driver
         driver_register
         ? bert_init
         ghes_init
         do_one_initcall
         ? rcu_read_lock_sched_held
         kernel_init_freeable
         ? rest_init
         kernel_init
         ret_from_fork
         ...
        ghes_edac: ghes_edac_unregister: FALSE, refcount: -1073741824
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Link: https://lkml.kernel.org/r/20200911164950.GB19320@zn.tnic
      251c54ea
    • B
      EDAC/ghes: Clear scanned data on unload · cd8100f1
      Borislav Petkov 提交于
      Commit
      
        b972fdba ("EDAC/ghes: Fix NULL pointer dereference in ghes_edac_register()")
      
      didn't clear all the information from the scanned system and, more
      specifically, left ghes_hw.num_dimms to its previous value. On a
      second load (CONFIG_DEBUG_TEST_DRIVER_REMOVE=y), the driver would use
      the leftover num_dimms value which is not 0 and thus the 0 check in
      enumerate_dimms() will get bypassed and it would go directly to the
      pointer deref:
      
        d = &hw->dimms[hw->num_dimms];
      
      which is, of course, NULL:
      
        #PF: supervisor write access in kernel mode
        #PF: error_code(0x0002) - not-present page
        PGD 0 P4D 0
        Oops: 0002 [#1] PREEMPT SMP
        CPU: 7 PID: 1 Comm: swapper/0 Not tainted 5.9.0-rc4+ #7
        Hardware name: GIGABYTE MZ01-CE1-00/MZ01-CE1-00, BIOS F02 08/29/2018
        RIP: 0010:enumerate_dimms.cold+0x7b/0x375
      
      Reset the whole ghes_hw on driver unregister so that no stale values are
      used on a second system scan.
      
      Fixes: b972fdba ("EDAC/ghes: Fix NULL pointer dereference in ghes_edac_register()")
      Cc: Shiju Jose <shiju.jose@huawei.com>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Link: https://lkml.kernel.org/r/20200911164817.GA19320@zn.tnic
      cd8100f1
  16. 09 9月, 2020 1 次提交
  17. 02 9月, 2020 2 次提交
  18. 01 9月, 2020 1 次提交
  19. 28 8月, 2020 1 次提交
  20. 24 8月, 2020 1 次提交
  21. 20 8月, 2020 1 次提交
  22. 18 8月, 2020 1 次提交
  23. 17 8月, 2020 3 次提交