From patchwork Thu Sep 16 09:34:54 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 418 Return-Path: Received: from mail.gmx.net (mailout-de.gmx.net [213.165.64.23]) by open-mesh.org (Postfix) with SMTP id C7973154342 for ; Thu, 16 Sep 2010 11:34:08 +0200 (CEST) Received: (qmail invoked by alias); 16 Sep 2010 09:34:08 -0000 Received: from unknown (EHLO sven-desktop.lazhur.ath.cx) [89.246.214.232] by mail.gmx.net (mp023) with SMTP; 16 Sep 2010 11:34:08 +0200 X-Authenticated: #15668376 X-Provags-ID: V01U2FsdGVkX19URClSr4FUiB11ZKJ5UtkT3KhJvkyJluMgMXotAB LqeKfHQVat1Rjh From: Sven Eckelmann To: b.a.t.m.a.n@lists.open-mesh.org Date: Thu, 16 Sep 2010 11:34:54 +0200 Message-Id: <1284629694-20581-1-git-send-email-sven.eckelmann@gmx.de> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <1284629407-20394-1-git-send-email-sven.eckelmann@gmx.de> References: <1284629407-20394-1-git-send-email-sven.eckelmann@gmx.de> X-Y-GMX-Trusted: 0 Subject: [B.A.T.M.A.N.] [PATCHv2] batman-adv: Mark debugfs files as nonseekable X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.11 Precedence: list Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Sep 2010 09:34:09 -0000 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 Cc: Arnd Bergmann --- I think it is according to Arnd's patch the cleanest version to say that those files are nonseekable. Sry for the wrong subject. Of course it is not for batctl, but for batman-adv. Seems that I mixed it up while testing those changes with batctl batman-adv/bat_debugfs.c | 2 ++ batman-adv/icmp_socket.c | 3 +++ 2 files changed, 5 insertions(+), 0 deletions(-) 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)