From nobody Tue Jun 30 21:11:25 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 706F8C433EF for ; Sun, 9 Jan 2022 20:16:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236879AbiAIUQE (ORCPT ); Sun, 9 Jan 2022 15:16:04 -0500 Received: from isilmar-4.linta.de ([136.243.71.142]:48490 "EHLO isilmar-4.linta.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229883AbiAIUQD (ORCPT ); Sun, 9 Jan 2022 15:16:03 -0500 X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES Received: from owl.dominikbrodowski.net (owl.brodo.linta [10.2.0.111]) by isilmar-4.linta.de (Postfix) with ESMTPSA id F08E82013EC; Sun, 9 Jan 2022 20:15:59 +0000 (UTC) Received: by owl.dominikbrodowski.net (Postfix, from userid 1000) id C345680240; Sun, 9 Jan 2022 21:14:23 +0100 (CET) From: Dominik Brodowski To: linux-kernel@vger.kernel.org Cc: Matthew Wilcox , Greg Kroah-Hartman , Al Viro Subject: [PATCH] pcmcia: fix setting of kthread task states Date: Sun, 9 Jan 2022 21:14:15 +0100 Message-Id: <20220109201415.78895-1-linux@dominikbrodowski.net> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" We need to set TASK_INTERRUPTIBLE before calling kthread_should_stop(). Otherwise, kthread_stop() might see that the pccardd thread is still in TASK_RUNNING state and fail to wake it up. Additonally, we only need to set the state back to TASK_RUNNING if kthread_should_stop() breaks the loop. Cc: Matthew Wilcox Cc: Greg Kroah-Hartman Reported-by: Al Viro Fixes: d3046ba809ce ("pcmcia: fix a boot time warning in pcmcia cs code") Signed-off-by: Dominik Brodowski Reviewed-by: Matthew Wilcox (Oracle) --- drivers/pcmcia/cs.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c index e211e2619680..f70197154a36 100644 --- a/drivers/pcmcia/cs.c +++ b/drivers/pcmcia/cs.c @@ -666,18 +666,16 @@ static int pccardd(void *__skt) if (events || sysfs_events) continue; =20 + set_current_state(TASK_INTERRUPTIBLE); if (kthread_should_stop()) break; =20 - set_current_state(TASK_INTERRUPTIBLE); - schedule(); =20 - /* make sure we are running */ - __set_current_state(TASK_RUNNING); - try_to_freeze(); } + /* make sure we are running before we exit */ + __set_current_state(TASK_RUNNING); =20 /* shut down socket, if a device is still present */ if (skt->state & SOCKET_PRESENT) { --=20 2.34.1