From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 58C8F43B490; Tue, 21 Jul 2026 22:08:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784671685; cv=none; b=BAS6VqNCqlJYPuJVwGFPjT+VTLi1HE5O76M3YHgHCO3GY4rWp0vsXtMPWAeBz2pnIWwNgby2FelBkyp7sWZG2/82dQKNTeKB8qbipr+jbMohgksGEhNhtbEAw/Ygxn5YgMdx0N3xu1JiwOIG6qH+k3QDzlNQdbNWMrTxedSKnSk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784671685; c=relaxed/simple; bh=jkTAaoCWQSnrKA2qXlvOjx/G1nYlrGiUgUkeng3I1y0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MWiu+iCdDjiRLeAFyHe4K6oZz9NVF9EfV2M8K5SURa3rgIvqFg0TCddzHBgFogzFfOPmABoSsMVvvJoM9NzfjoYCW73trC6+9TTfNIt/PSemD4j+Ek+dG6zB+2qUsIxWYoq4P95PqSuHNgtJdESuBG1/3uKsFklsY3PEzBPdA4M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=mc+lkUtu; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="mc+lkUtu" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A7051F000E9; Tue, 21 Jul 2026 22:08:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784671683; bh=VuOD/rIxTqvJ3ZVbZJKsEhUepWvcZsbrIu74vENNx2Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=mc+lkUtuTDplXYXU8n69tJQ4v8dCtl9FImj9YkCyExpLx44kISPAPkVoLvfNgI+C7 4kSSdh2JaACHgIfnouIXoxUObDEPK8uyAz5MailD3am2ADEK9MTcq7+47M+RCWIqAo XYrT/RltR2WEpWGpiQcvKv6DTFg9FizKJ5bpl4TQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Yuho Choi , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.15 312/843] ACPI: IPMI: Fix message kref handling on dead device Date: Tue, 21 Jul 2026 17:19:07 +0200 Message-ID: <20260721152413.041051205@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152405.946368001@linuxfoundation.org> References: <20260721152405.946368001@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Yuho Choi [ Upstream commit 63320db6a5d84ec3fed8b3d36ba5244d07ddd108 ] acpi_ipmi_space_handler() takes an extra reference on tx_msg before checking whether the selected IPMI device is dead. The reference belongs to the tx_msg_list entry and is normally dropped by ipmi_cancel_tx_msg() or ipmi_flush_tx_msg() after the message is removed from the list. On the dead-device path, the message has not been queued yet, but the error path still calls ipmi_msg_release() directly. That bypasses kref_put() and frees tx_msg while the queued-message reference is still recorded in the kref count. Take the queued-message reference only after the dead-device check succeeds, immediately before adding tx_msg to the list. Fixes: 7b9844772237 ("ACPI / IPMI: Add reference counting for ACPI IPMI transfers") Signed-off-by: Yuho Choi Link: https://patch.msgid.link/20260603163108.2149359-1-dbgh9129@gmail.com Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/acpi/acpi_ipmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/acpi/acpi_ipmi.c b/drivers/acpi/acpi_ipmi.c index a5fe2926bf5064..6878a7684352a6 100644 --- a/drivers/acpi/acpi_ipmi.c +++ b/drivers/acpi/acpi_ipmi.c @@ -548,7 +548,6 @@ acpi_ipmi_space_handler(u32 function, acpi_physical_address address, return AE_TYPE; } - acpi_ipmi_msg_get(tx_msg); mutex_lock(&driver_data.ipmi_lock); /* Do not add a tx_msg that can not be flushed. */ if (ipmi_device->dead) { @@ -556,6 +555,7 @@ acpi_ipmi_space_handler(u32 function, acpi_physical_address address, ipmi_msg_release(tx_msg); return AE_NOT_EXIST; } + acpi_ipmi_msg_get(tx_msg); spin_lock_irqsave(&ipmi_device->tx_msg_lock, flags); list_add_tail(&tx_msg->head, &ipmi_device->tx_msg_list); spin_unlock_irqrestore(&ipmi_device->tx_msg_lock, flags); -- 2.53.0