batctl: Mark debugfs files as nonseekable

Message ID 1284629407-20394-1-git-send-email-sven.eckelmann@gmx.de (mailing list archive)
State Accepted, archived
Headers

Commit Message

Sven Eckelmann Sept. 16, 2010, 9:30 a.m. UTC
  We don't allow to seek in the debugfs socket and log files. Thus we
should mark the file descriptor as nonseekable.

Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
Cc: Arnd Bergmann <arnd@arndb.de>
---
I think it is according to Arnd's patch the cleanest version to say that
those files are nonseekable.

 batman-adv/bat_debugfs.c |    2 ++
 batman-adv/icmp_socket.c |    3 +++
 2 files changed, 5 insertions(+), 0 deletions(-)
  

Comments

Arnd Bergmann Sept. 16, 2010, 12:51 p.m. UTC | #1
On Thursday 16 September 2010, Sven Eckelmann wrote:
> We don't allow to seek in the debugfs socket and log files. Thus we
> should mark the file descriptor as nonseekable.
> 
> Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
> Cc: Arnd Bergmann <arnd@arndb.de>

Acked-by: Arnd Bergmann <arnd@arndb.de>

Looks good. Do you want to merge it yourself? Otherwise I'll queue it up
in my tree.

	Arnd
  
Sven Eckelmann Sept. 16, 2010, 1:16 p.m. UTC | #2
Arnd Bergmann wrote:
> On Thursday 16 September 2010, Sven Eckelmann wrote:
> > We don't allow to seek in the debugfs socket and log files. Thus we
> > should mark the file descriptor as nonseekable.
> > 
> > Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
> > Cc: Arnd Bergmann <arnd@arndb.de>
> 
> Acked-by: Arnd Bergmann <arnd@arndb.de>
> 
> Looks good. Do you want to merge it yourself? Otherwise I'll queue it up
> in my tree.

This patch is for the batman-adv repository (so the paths aren't 100% ready 
for the kernel tree). So I would wait for Marek Lindner to approve it and than 
wandering from there to Gregs staging-next tree for 2.6.37.

I've just Cc'ed you that you know that this clashes slightly with your llseek 
patches (which you wanted to cleanup - so the batman-adv part can be dropped).

Best regards,
	Sven
  
Marek Lindner Sept. 18, 2010, 11:14 a.m. UTC | #3
On Thursday 16 September 2010 15:16:26 Sven Eckelmann wrote:
> Arnd Bergmann wrote:
> > On Thursday 16 September 2010, Sven Eckelmann wrote:
> > > We don't allow to seek in the debugfs socket and log files. Thus we
> > > should mark the file descriptor as nonseekable.
> > > 
> > > Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
> > > Cc: Arnd Bergmann <arnd@arndb.de>
> > 
> > Acked-by: Arnd Bergmann <arnd@arndb.de>
> > 
> > Looks good. Do you want to merge it yourself? Otherwise I'll queue it up
> > in my tree.
> 
> This patch is for the batman-adv repository (so the paths aren't 100% ready
> for the kernel tree). So I would wait for Marek Lindner to approve it and
> than wandering from there to Gregs staging-next tree for 2.6.37.

The patch looks good. It is in our repos now.

Thanks,
Marek
  

Patch

diff --git a/batman-adv/bat_debugfs.c b/batman-adv/bat_debugfs.c
index c73ce4a..bd4a12e 100644
--- a/batman-adv/bat_debugfs.c
+++ b/batman-adv/bat_debugfs.c
@@ -93,6 +93,7 @@  int debug_log(struct bat_priv *bat_priv, char *fmt, ...)
 
 static int log_open(struct inode *inode, struct file *file)
 {
+	nonseekable_open(inode, file);
 	file->private_data = inode->i_private;
 	inc_module_count();
 	return 0;
@@ -177,6 +178,7 @@  static const struct file_operations log_fops = {
 	.release        = log_release,
 	.read           = log_read,
 	.poll           = log_poll,
+	.llseek         = no_llseek,
 };
 
 static int debug_log_setup(struct bat_priv *bat_priv)
diff --git a/batman-adv/icmp_socket.c b/batman-adv/icmp_socket.c
index 85c047b..aa64ff8 100644
--- a/batman-adv/icmp_socket.c
+++ b/batman-adv/icmp_socket.c
@@ -47,6 +47,8 @@  static int bat_socket_open(struct inode *inode, struct file *file)
 	unsigned int i;
 	struct socket_client *socket_client;
 
+	nonseekable_open(inode, file);
+
 	socket_client = kmalloc(sizeof(struct socket_client), GFP_KERNEL);
 
 	if (!socket_client)
@@ -285,6 +287,7 @@  static const struct file_operations fops = {
 	.read = bat_socket_read,
 	.write = bat_socket_write,
 	.poll = bat_socket_poll,
+	.llseek = no_llseek,
 };
 
 int bat_socket_setup(struct bat_priv *bat_priv)