1. 15 Aug, 2023 1 commit
  2. 04 Jul, 2023 1 commit
    • Chengfeng Ye's avatar
      ipmi: fix potential deadlock on &kcs_bmc->lock · b02bb79e
      Chengfeng Ye authored
      As kcs_bmc_handle_event() is executed inside both a timer and a hardirq,
      it should disable irq before lock acquisition otherwise deadlock could
      happen if the timmer is preemtped by the irq.
      
      Possible deadlock scenario:
      aspeed_kcs_check_obe() (timer)
          -> kcs_bmc_handle_event()
          -> spin_lock(&kcs_bmc->lock)
              <irq interruption>
              -> aspeed_kcs_irq()
              -> kcs_bmc_handle_event()
              -> spin_lock(&kcs_bmc->lock) (deadlock here)
      
      This flaw was found using an experimental static analysis tool we are
      developing for irq-related deadlock.
      
      The tentative patch fix the potential deadlock by spin_lock_irqsave()
      Signed-off-by: default avatarChengfeng Ye <dg573847474@gmail.com>
      Message-Id: <20230627152449.36093-1-dg573847474@gmail.com>
      Signed-off-by: default avatarCorey Minyard <minyard@acm.org>
      b02bb79e
  3. 29 Jun, 2023 1 commit
    • Yi Yang's avatar
      ipmi_si: fix a memleak in try_smi_init() · 6cf1a126
      Yi Yang authored
      Kmemleak reported the following leak info in try_smi_init():
      
      unreferenced object 0xffff00018ecf9400 (size 1024):
        comm "modprobe", pid 2707763, jiffies 4300851415 (age 773.308s)
        backtrace:
          [<000000004ca5b312>] __kmalloc+0x4b8/0x7b0
          [<00000000953b1072>] try_smi_init+0x148/0x5dc [ipmi_si]
          [<000000006460d325>] 0xffff800081b10148
          [<0000000039206ea5>] do_one_initcall+0x64/0x2a4
          [<00000000601399ce>] do_init_module+0x50/0x300
          [<000000003c12ba3c>] load_module+0x7a8/0x9e0
          [<00000000c246fffe>] __se_sys_init_module+0x104/0x180
          [<00000000eea99093>] __arm64_sys_init_module+0x24/0x30
          [<0000000021b1ef87>] el0_svc_common.constprop.0+0x94/0x250
          [<0000000070f4f8b7>] do_el0_svc+0x48/0xe0
          [<000000005a05337f>] el0_svc+0x24/0x3c
          [<000000005eb248d6>] el0_sync_handler+0x160/0x164
          [<0000000030a59039>] el0_sync+0x160/0x180
      
      The problem was that when an error occurred before handlers registration
      and after allocating `new_smi->si_sm`, the variable wouldn't be freed in
      the error handling afterwards since `shutdown_smi()` hadn't been
      registered yet. Fix it by adding a `kfree()` in the error handling path
      in `try_smi_init()`.
      
      Cc: stable@vger.kernel.org # 4.19+
      Fixes: 7960f18a ("ipmi_si: Convert over to a shutdown handler")
      Signed-off-by: default avatarYi Yang <yiyang13@huawei.com>
      Co-developed-by: default avatarGONG, Ruiqi <gongruiqi@huaweicloud.com>
      Signed-off-by: default avatarGONG, Ruiqi <gongruiqi@huaweicloud.com>
      Message-Id: <20230629123328.2402075-1-gongruiqi@huaweicloud.com>
      Signed-off-by: default avatarCorey Minyard <minyard@acm.org>
      6cf1a126
  4. 20 Jun, 2023 3 commits
    • Corey Minyard's avatar
      ipmi: Change request_module to request_module_nowait · e87443a5
      Corey Minyard authored
      When probing for an ACPI-specified IPMI device, the code would request
      that the acpi_ipmi module be loaded ACPI operations through IPMI can be
      performed.  This could happen through module load context, for instance,
      if an I2C module is loaded that caused the IPMI interface to be probed.
      
      This is not allowed because a synchronous module load in this context
      can result in an deadlock, and I was getting a warning:
      
      [   23.967853] WARNING: CPU: 0 PID: 21 at kernel/module/kmod.c:144 __request_module+0x1de/0x2d0
      [   23.968852] Modules linked in: i2c_i801 ipmi_ssif
      
      The IPMI driver is not dependent on acpi_ipmi, so just change the called
      to request_module_nowait to make the load asynchronous.
      Signed-off-by: default avatarCorey Minyard <minyard@acm.org>
      e87443a5
    • Ivan Orlov's avatar
      ipmi: make ipmi_class a static const structure · 392fa3a3
      Ivan Orlov authored
      Now that the driver core allows for struct class to be in read-only
      memory, move the ipmi_class structure to be declared at build time
      placing it into read-only memory, instead of having to be dynamically
      allocated at boot time.
      
      Cc: Corey Minyard <minyard@acm.org>
      Cc: openipmi-developer@lists.sourceforge.net
      Suggested-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarIvan Orlov <ivan.orlov0322@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Message-Id: <20230620143701.577657-2-gregkh@linuxfoundation.org>
      Signed-off-by: default avatarCorey Minyard <minyard@acm.org>
      392fa3a3
    • Corey Minyard's avatar
      ipmi:ssif: Fix a memory leak when scanning for an adapter · b8d72e32
      Corey Minyard authored
      The adapter scan ssif_info_find() sets info->adapter_name if the adapter
      info came from SMBIOS, as it's not set in that case.  However, this
      function can be called more than once, and it will leak the adapter name
      if it had already been set.  So check for NULL before setting it.
      
      Fixes: c4436c91 ("ipmi_ssif: avoid registering duplicate ssif interface")
      Signed-off-by: default avatarCorey Minyard <minyard@acm.org>
      b8d72e32
  5. 19 Jun, 2023 1 commit
  6. 10 Jun, 2023 1 commit
  7. 25 May, 2023 1 commit
  8. 18 May, 2023 1 commit
  9. 17 May, 2023 4 commits
  10. 15 May, 2023 4 commits
  11. 14 May, 2023 16 commits
  12. 13 May, 2023 6 commits