summaryrefslogtreecommitdiff
path: root/include/linux/uio_driver.h
diff options
context:
space:
mode:
authorHamish Martin <hamish.martin@alliedtelesis.co.nz>2018-05-14 13:32:23 +1200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-05-14 16:16:35 +0200
commita93e7b331568227500186a465fee3c2cb5dffd1f (patch)
tree9eb90315fad535118c90264d2d1d189913bbfe9b /include/linux/uio_driver.h
parent81daa406c2cc97d85eef9409400404efc2a3f756 (diff)
uio: Prevent device destruction while fds are open
Prevent destruction of a uio_device while user space apps hold open file descriptors to that device. Further, access to the 'info' member of the struct uio_device is protected by spinlock. This is to ensure stale pointers to data not under control of the UIO subsystem are not dereferenced. Signed-off-by: Hamish Martin <hamish.martin@alliedtelesis.co.nz> Reviewed-by: Chris Packham <chris.packham@alliedtelesis.co.nz> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/uio_driver.h')
-rw-r--r--include/linux/uio_driver.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/include/linux/uio_driver.h b/include/linux/uio_driver.h
index 3c85c81b0027..6c5f2074e14f 100644
--- a/include/linux/uio_driver.h
+++ b/include/linux/uio_driver.h
@@ -14,6 +14,7 @@
#ifndef _UIO_DRIVER_H_
#define _UIO_DRIVER_H_
+#include <linux/device.h>
#include <linux/fs.h>
#include <linux/interrupt.h>
@@ -68,12 +69,13 @@ struct uio_port {
struct uio_device {
struct module *owner;
- struct device *dev;
+ struct device dev;
int minor;
atomic_t event;
struct fasync_struct *async_queue;
wait_queue_head_t wait;
struct uio_info *info;
+ spinlock_t info_lock;
struct kobject *map_dir;
struct kobject *portio_dir;
};