summaryrefslogtreecommitdiff
path: root/include/linux/counter.h
diff options
context:
space:
mode:
authorDavid Lechner <david@lechnology.com>2021-10-17 13:55:21 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-10-19 11:36:28 +0200
commitf5245a5fdf757f50a6c905fc16cceb1a6146ccf5 (patch)
tree80a651b5444b70ceff26f93d2e97e37cd64c6f7b /include/linux/counter.h
parentc3ed761c9e1e4987406671b326dab48a048614ee (diff)
counter: drop chrdev_lock
This removes the chrdev_lock from the counter subsystem. This was intended to prevent opening the chrdev more than once. However, this doesn't work in practice since userspace can duplicate file descriptors and pass file descriptors to other processes. Since this protection can't be relied on, it is best to just remove it. Suggested-by: Greg KH <gregkh@linuxfoundation.org> Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com> Signed-off-by: David Lechner <david@lechnology.com> Link: https://lore.kernel.org/r/20211017185521.3468640-1-david@lechnology.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/counter.h')
-rw-r--r--include/linux/counter.h7
1 files changed, 0 insertions, 7 deletions
diff --git a/include/linux/counter.h b/include/linux/counter.h
index 22b14a552b1d..0fd99e255a50 100644
--- a/include/linux/counter.h
+++ b/include/linux/counter.h
@@ -297,7 +297,6 @@ struct counter_ops {
* @events: queue of detected Counter events
* @events_wait: wait queue to allow blocking reads of Counter events
* @events_lock: lock to protect Counter events queue read operations
- * @chrdev_lock: lock to limit chrdev to a single open at a time
* @ops_exist_lock: lock to prevent use during removal
*/
struct counter_device {
@@ -325,12 +324,6 @@ struct counter_device {
DECLARE_KFIFO_PTR(events, struct counter_event);
wait_queue_head_t events_wait;
struct mutex events_lock;
- /*
- * chrdev_lock is locked by counter_chrdev_open() and unlocked by
- * counter_chrdev_release(), so a mutex is not possible here because
- * chrdev_lock will invariably be held when returning to user space
- */
- atomic_t chrdev_lock;
struct mutex ops_exist_lock;
};