lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 23 Mar 2015 13:59:49 +0100
From:	Martin Kepplinger <martink@...teo.de>
To:	tomvanbraeckel@...il.com
Cc:	linux-kernel@...r.kernel.org, gregkh@...uxfoundation.org,
	arnd@...db.de, Martin Kepplinger <martink@...teo.de>
Subject: [PATCH 4/4] lguest: explicitly set miscdevice's private_data NULL

There is a proposed change to the miscdevice's behaviour on open(). Currently
file->private_data stays NULL, but only because we don't have an open-entry in
struct file_operations.

This may change so that private_data, more consistently, is always set to
struct miscdevice, not only *if* the driver has it's own open() routine and
fops-entry, see https://lkml.org/lkml/2014/12/4/939

In short: If we rely on file->private_data being NULL, we should ensure
it is NULL ourselves.

Signed-off-by: Martin Kepplinger <martink@...teo.de>
---
 drivers/lguest/lguest_user.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/lguest/lguest_user.c b/drivers/lguest/lguest_user.c
index c4c6113..30c6068 100644
--- a/drivers/lguest/lguest_user.c
+++ b/drivers/lguest/lguest_user.c
@@ -339,6 +339,13 @@ static ssize_t write(struct file *file, const char __user *in,
 	}
 }
 
+static int open(struct inode *inode, struct file *file)
+{
+	file->private_data = NULL;
+
+	return 0;
+}
+
 /*L:060
  * The final piece of interface code is the close() routine.  It reverses
  * everything done in initialize().  This is usually called because the
@@ -409,6 +416,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,
-- 
2.1.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

Powered by Openwall GNU/*/Linux Powered by OpenVZ