Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/external/bsd/common/linux Work is not necessarily queued...
details: https://anonhg.NetBSD.org/src/rev/c1cd60d50098
branches: trunk
changeset: 835422:c1cd60d50098
user: riastradh <riastradh%NetBSD.org@localhost>
date: Mon Aug 27 14:57:55 2018 +0000
description:
Work is not necessarily queued in cancel_work.
diffstat:
sys/external/bsd/common/linux/linux_work.c | 18 ++++++++++++------
1 files changed, 12 insertions(+), 6 deletions(-)
diffs (60 lines):
diff -r 5a75f93b91d3 -r c1cd60d50098 sys/external/bsd/common/linux/linux_work.c
--- a/sys/external/bsd/common/linux/linux_work.c Mon Aug 27 14:57:21 2018 +0000
+++ b/sys/external/bsd/common/linux/linux_work.c Mon Aug 27 14:57:55 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_work.c,v 1.12 2018/08/27 14:57:21 riastradh Exp $ */
+/* $NetBSD: linux_work.c,v 1.13 2018/08/27 14:57:55 riastradh Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.12 2018/08/27 14:57:21 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.13 2018/08/27 14:57:55 riastradh Exp $");
#include <sys/types.h>
#include <sys/atomic.h>
@@ -348,7 +348,10 @@
struct workqueue_struct *wq;
bool cancelled_p = false;
- wq = work->work_queue;
+ /* If there's no workqueue, nothing to cancel. */
+ if ((wq = work->work_queue) == NULL)
+ goto out;
+
mutex_enter(&wq->wq_lock);
if (__predict_false(work->work_queue != wq)) {
cancelled_p = false;
@@ -360,7 +363,7 @@
}
mutex_exit(&wq->wq_lock);
- return cancelled_p;
+out: return cancelled_p;
}
bool
@@ -369,7 +372,10 @@
struct workqueue_struct *wq;
bool cancelled_p = false;
- wq = work->work_queue;
+ /* If there's no workqueue, nothing to cancel. */
+ if ((wq = work->work_queue) == NULL)
+ goto out;
+
mutex_enter(&wq->wq_lock);
if (__predict_false(work->work_queue != wq)) {
cancelled_p = false;
@@ -384,7 +390,7 @@
}
mutex_exit(&wq->wq_lock);
- return cancelled_p;
+out: return cancelled_p;
}
/*
Home |
Main Index |
Thread Index |
Old Index