[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1413678660-29669-3-git-send-email-martink@posteo.de>
Date: Sun, 19 Oct 2014 02:31:00 +0200
From: Martin Kepplinger <martink@...teo.de>
To: gregkh@...uxfoundation.org
Cc: arnd@...db.de, akpm@...ux-foundation.org,
linux-kernel@...r.kernel.org, Martin Kepplinger <martink@...teo.de>
Subject: [PATCH 3/3] lguest: force file->private_data to be NULL on open()
if we depend on private_data being NULL in write() before initialize()
make sure it is NULL after open().
Signed-off-by: Martin Kepplinger <martink@...teo.de>
---
I'm not completely sure if this patch is needed and am still investigating.
What do you think? open() could be called by the user I guess. Does
lguest_user.c depend on private_data being NULL on a first write()?
drivers/lguest/lguest_user.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/lguest/lguest_user.c b/drivers/lguest/lguest_user.c
index 4263f4c..30251b7 100644
--- a/drivers/lguest/lguest_user.c
+++ b/drivers/lguest/lguest_user.c
@@ -497,6 +497,12 @@ static int close(struct inode *inode, struct file *file)
return 0;
}
+static int open(struct inode *inode, struct file *file)
+{
+ /* the miscdevice core sets private_data on open() */
+ file->private_data = NULL;
+}
+
/*L:000
* Welcome to our journey through the Launcher!
*
@@ -514,6 +520,7 @@ static int close(struct inode *inode, struct file *file)
*/
static const struct file_operations lguest_fops = {
.owner = THIS_MODULE,
+ .open = open,
.release = close,
.write = write,
.read = read,
--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists