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 54F95248F57; Tue, 21 Jul 2026 15:55:42 +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=1784649343; cv=none; b=nGwMI3YnN/Y5PrCBcur4K8G9fCOoLMFwOSEUiF5tZRrw7wY6CsJaXcQ1qwL9BmELfFkXPxAduCgzMLd9kGxpmt9XGocPUcOg2YFutrqFyNLCKk6CTy3O5Nsv4c6q2qNdnCHlaAEvqbTjY7Xgo/8z2vKndbnBtVsbIX2AF5G+nOM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784649343; c=relaxed/simple; bh=glzvYL0acBHScW3Yxi5zVUTuDvhMM6CUIfl23T/hSgU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FhpB9uNuikvapq0pqIkck7sZZr6ikNRahLSwxjx9PASqsZkpafrX7YhGJR14fyTgE6aC9iCUtXnG/vL3F6XS6OYUGz/HVwyOwUlmoN3uv01cks5riG3z7RY7hj1o7GATSMDrjnuFxMzzLx83GnOyidFupXFPtBCzmUvPgPMOzmA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=q5ADDvT7; 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="q5ADDvT7" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B95741F00A3A; Tue, 21 Jul 2026 15:55:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784649342; bh=+SRVMvjR2MVsGakqQcQZ1G/vWbMULNV32s1BRV8gX2c=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=q5ADDvT7U/EDo4RwhJCVyNgL9WrcpV3CEpOUB4JU9NAw7utQE67t7Myg5ASUa2y4S 2TODcE7UpT1jBeyo5Npa/d+pv1y1atH+Q6Wz43InO+Jftm0egfCG4ODNgZF6hySF+8 o6PEStgsFqQRefsXVtXmxuBNt77MaT05HQbP0iDI= 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 7.1 0540/2077] ACPI: IPMI: Fix message kref handling on dead device Date: Tue, 21 Jul 2026 17:03:33 +0200 Message-ID: <20260721152605.547867017@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152552.646164743@linuxfoundation.org> References: <20260721152552.646164743@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 7.1-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 8f1aeae8b72ed7..79ce6e72bf295a 100644 --- a/drivers/acpi/acpi_ipmi.c +++ b/drivers/acpi/acpi_ipmi.c @@ -550,7 +550,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) { @@ -558,6 +557,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