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 938522FDC5E; Sat, 30 May 2026 18:33:10 +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=1780165991; cv=none; b=Dvx1kIpOLACXApE5v7lnDzU7wr+7UiIBoiE/mrJes7AgMwfwVJfgw71HqI4xWvztkazJNWOVr8C/no7uoVjQAOowYl+aVpPdaXzyatuP4QjI8KUEg2wFjERDdAVNri06do81OdYA+Xjs8avkmZY/93IvetLHnM02yLj3/4rSRW4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780165991; c=relaxed/simple; bh=juS5BwbpN+xEVs7BazDwHK+smRxk/H+GQLavkhtl80o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aQek9YaAI2660Aw7ohGwy3tGXy4ph2BI4dVfNH0Dipdjq00BPyfhjKph3IC4T2bm38n4XMsudf4rCN965xIAqM/eFaT5sBM1/YMwi+oLfxvP+p5g432AiYNk2XQkVvo2io0Exx0I/8ZJkeJh7nlQRovX+DFZX4VnDHREncvt0sw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=R0Dx3SYD; 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="R0Dx3SYD" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D74091F00893; Sat, 30 May 2026 18:33:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780165990; bh=J+c50AhTBeLQumxQqvFb1eDkzjTuhNlK9HPtmyejyUQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=R0Dx3SYDda9i1ICR6etDv6YbAatLU3JB5BF57nygOLmNT1h9RMSgnfjdYW2H2BDou qLj3lSNQnfi19GcX2XprKNnrUY7+G2zZhErQpqibpMfHGupcugAlJFjsUvCINpaLd+ tH1oRacdyDT7z50NalaYPRqt3248VLwLiXMxVU2k= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Li Xiao <252270051@hdu.edu.cn>, Corey Minyard , Sasha Levin Subject: [PATCH 5.10 213/589] ipmi:ssif: Clean up kthread on errors Date: Sat, 30 May 2026 18:01:34 +0200 Message-ID: <20260530160230.567581130@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260530160224.570625122@linuxfoundation.org> References: <20260530160224.570625122@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.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Corey Minyard commit 75c486cb1bcaa1a3ec3a6438498176a3a4998ae4 upstream. If an error occurs after the ssif kthread is created, but before the main IPMI code starts the ssif interface, the ssif kthread will not be stopped. So make sure the kthread is stopped on an error condition if it is running. Fixes: 259307074bfc ("ipmi: Add SMBus interface driver (SSIF)") Reported-by: Li Xiao <<252270051@hdu.edu.cn> Cc: stable@vger.kernel.org Reviewed-by: Li Xiao <252270051@hdu.edu.cn> [Adjusted for stopping flag and complete operation still being present.] Signed-off-by: Corey Minyard Signed-off-by: Sasha Levin --- drivers/char/ipmi/ipmi_ssif.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c index 42cbf761fa749..55ebe1d31766b 100644 --- a/drivers/char/ipmi/ipmi_ssif.c +++ b/drivers/char/ipmi/ipmi_ssif.c @@ -1311,6 +1311,7 @@ static void shutdown_ssif(void *send_info) if (ssif_info->thread) { complete(&ssif_info->wake_thread); kthread_stop(ssif_info->thread); + ssif_info->thread = NULL; } } @@ -1941,6 +1942,17 @@ static int ssif_probe(struct i2c_client *client, const struct i2c_device_id *id) out: if (rv) { + /* + * If ipmi_register_smi() starts the interface, it will + * call shutdown and that will free the thread and set + * it to NULL. Otherwise it must be freed here. + */ + if (ssif_info->thread) { + ssif_info->stopping = true; + complete(&ssif_info->wake_thread); + kthread_stop(ssif_info->thread); + ssif_info->thread = NULL; + } if (addr_info) addr_info->client = NULL; -- 2.53.0