lkml.org 
[lkml]   [2014]   [Oct]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 3/3] lguest: force file->private_data to be NULL on open()
Date
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@posteo.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


\
 
 \ /
  Last update: 2014-10-19 02:41    [W:0.056 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site