Messages in this thread Patch in this message | | | From | Martin Kepplinger <> | Subject | [PATCH 3/3] lguest: force file->private_data to be NULL on open() | Date | Sun, 19 Oct 2014 02:31:00 +0200 |
| |
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
| |