Module Name: src Committed By: riastradh Date: Sun Dec 19 12:24:19 UTC 2021
Modified Files: src/sys/external/bsd/drm2/linux: linux_kthread.c Log Message: linux: Paranoia: Don't read kt_shouldstop unlocked. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/external/bsd/drm2/linux/linux_kthread.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/external/bsd/drm2/linux/linux_kthread.c diff -u src/sys/external/bsd/drm2/linux/linux_kthread.c:1.1 src/sys/external/bsd/drm2/linux/linux_kthread.c:1.2 --- src/sys/external/bsd/drm2/linux/linux_kthread.c:1.1 Sun Dec 19 12:23:07 2021 +++ src/sys/external/bsd/drm2/linux/linux_kthread.c Sun Dec 19 12:24:19 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: linux_kthread.c,v 1.1 2021/12/19 12:23:07 riastradh Exp $ */ +/* $NetBSD: linux_kthread.c,v 1.2 2021/12/19 12:24:19 riastradh Exp $ */ /*- * Copyright (c) 2021 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_kthread.c,v 1.1 2021/12/19 12:23:07 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_kthread.c,v 1.2 2021/12/19 12:24:19 riastradh Exp $"); #include <sys/types.h> @@ -171,8 +171,14 @@ kthread_stop(struct task_struct *T) int kthread_should_stop(void) { + struct task_struct *T = linux_kthread(); + bool shouldstop; + + mutex_enter(&T->kt_lock); + shouldstop = T->kt_shouldstop; + mutex_exit(&T->kt_lock); - return linux_kthread()->kt_shouldstop; + return shouldstop; } void