Skip to content

Commit 04ce9e2

Browse files
Dominik Brodowskigregkh
authored andcommitted
pcmcia: fix setting of kthread task states
[ Upstream commit fbb3485 ] 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. Additionally, we only need to set the state back to TASK_RUNNING if kthread_should_stop() breaks the loop. Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reported-by: Al Viro <viro@ZenIV.linux.org.uk> Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org> Fixes: d3046ba ("pcmcia: fix a boot time warning in pcmcia cs code") Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 5064bfe commit 04ce9e2

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

‎drivers/pcmcia/cs.c‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -666,18 +666,16 @@ static int pccardd(void *__skt)
666666
if (events || sysfs_events)
667667
continue;
668668

669+
set_current_state(TASK_INTERRUPTIBLE);
669670
if (kthread_should_stop())
670671
break;
671672

672-
set_current_state(TASK_INTERRUPTIBLE);
673-
674673
schedule();
675674

676-
/* make sure we are running */
677-
__set_current_state(TASK_RUNNING);
678-
679675
try_to_freeze();
680676
}
677+
/* make sure we are running before we exit */
678+
__set_current_state(TASK_RUNNING);
681679

682680
/* shut down socket, if a device is still present */
683681
if (skt->state & SOCKET_PRESENT) {

0 commit comments

Comments
 (0)