Skip to content
  1. Aug 22, 2023
  2. Aug 18, 2023
    • Junhao He's avatar
      coresight: trbe: Fix TRBE potential sleep in atomic context · c0a232f1
      Junhao He authored
      
      
      smp_call_function_single() will allocate an IPI interrupt vector to
      the target processor and send a function call request to the interrupt
      vector. After the target processor receives the IPI interrupt, it will
      execute arm_trbe_remove_coresight_cpu() call request in the interrupt
      handler.
      
      According to the device_unregister() stack information, if other process
      is useing the device, the down_write() may sleep, and trigger deadlocks
      or unexpected errors.
      
        arm_trbe_remove_coresight_cpu
          coresight_unregister
            device_unregister
              device_del
                kobject_del
                  __kobject_del
                    sysfs_remove_dir
                      kernfs_remove
                        down_write ---------> it may sleep
      
      Add a helper arm_trbe_disable_cpu() to disable TRBE precpu irq and reset
      per TRBE.
      Simply call arm_trbe_remove_coresight_cpu() directly without useing the
      smp_call_function_single(), which is the same as registering the TRBE
      coresight device.
      
      Fixes: 3fbf7f01 ("coresight: sink: Add TRBE driver")
      Signed-off-by: default avatarJunhao He <hejunhao3@huawei.com>
      Link: https://lore.kernel.org/r/20230814093813.19152-2-hejunhao3@huawei.com
      
      
      [ Remove duplicate cpumask checks during removal ]
      Signed-off-by: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
      [ v3 - Remove the operation of assigning NULL to cpudata->drvdata ]
      Signed-off-by: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
      Link: https://lore.kernel.org/r/20230818084052.10116-1-hejunhao3@huawei.com
      c0a232f1
    • Junhao He's avatar
      coresight: Fix memory leak in acpi_buffer->pointer · 1a9e0267
      Junhao He authored
      
      
      There are memory leaks reported by kmemleak:
      ...
      unreferenced object 0xffff00213c141000 (size 1024):
        comm "systemd-udevd", pid 2123, jiffies 4294909467 (age 6062.160s)
        hex dump (first 32 bytes):
          04 00 00 00 02 00 00 00 18 10 14 3c 21 00 ff ff  ...........<!...
          00 00 00 00 00 00 00 00 03 00 00 00 10 00 00 00  ................
        backtrace:
          [<000000004b7c9001>] __kmem_cache_alloc_node+0x2f8/0x348
          [<00000000b0fc7ceb>] __kmalloc+0x58/0x108
          [<0000000064ff4695>] acpi_os_allocate+0x2c/0x68
          [<000000007d57d116>] acpi_ut_initialize_buffer+0x54/0xe0
          [<0000000024583908>] acpi_evaluate_object+0x388/0x438
          [<0000000017b2e72b>] acpi_evaluate_object_typed+0xe8/0x240
          [<000000005df0eac2>] coresight_get_platform_data+0x1b4/0x988 [coresight]
      ...
      
      The ACPI buffer memory (buf.pointer) should be freed. But the buffer
      is also used after returning from acpi_get_dsd_graph().
      Move the temporary variables buf to acpi_coresight_parse_graph(),
      and free it before the function return to prevent memory leak.
      
      Fixes: 76ffa5ab ("coresight: Support for ACPI bindings")
      Signed-off-by: default avatarJunhao He <hejunhao3@huawei.com>
      Reviewed-by: default avatarJames Clark <james.clark@arm.com>
      Signed-off-by: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
      Link: https://lore.kernel.org/r/20230817085937.55590-2-hejunhao3@huawei.com
      1a9e0267
  3. Aug 17, 2023
  4. Aug 16, 2023
  5. Aug 15, 2023
  6. Aug 14, 2023
  7. Aug 13, 2023
  8. Aug 12, 2023