From patchwork Thu Sep 16 09:30:07 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 427 Return-Path: Received: from mail.gmx.net (mailout-de.gmx.net [213.165.64.23]) by open-mesh.org (Postfix) with SMTP id 8798C15430E for ; Thu, 16 Sep 2010 11:29:19 +0200 (CEST) Received: (qmail invoked by alias); 16 Sep 2010 09:29:18 -0000 Received: from unknown (EHLO sven-desktop.lazhur.ath.cx) [89.246.214.232] by mail.gmx.net (mp069) with SMTP; 16 Sep 2010 11:29:18 +0200 X-Authenticated: #15668376 X-Provags-ID: V01U2FsdGVkX1/kedgnpbzk+VT9hJSAZyrdj5U6+2X04oPU5Nutye Xgd+HI/OCqSrP5 From: Sven Eckelmann To: b.a.t.m.a.n@lists.open-mesh.org Date: Thu, 16 Sep 2010 11:30:07 +0200 Message-Id: <1284629407-20394-1-git-send-email-sven.eckelmann@gmx.de> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <1284589835-26617-1-git-send-email-sven.eckelmann@gmx.de> References: <1284589835-26617-1-git-send-email-sven.eckelmann@gmx.de> X-Y-GMX-Trusted: 0 Cc: Arnd Bergmann Subject: [B.A.T.M.A.N.] [PATCH] batctl: 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:29:24 -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 Acked-by: Arnd Bergmann --- 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(-) 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)