提交 2d77bb59 编写于 作者: S Sven Eckelmann 提交者: Greg Kroah-Hartman

Staging: batman-adv: Mark debugfs files as nonseekable

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: NSven Eckelmann <sven.eckelmann@gmx.de>
Acked-by: NArnd Bergmann <arnd@arndb.de>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 93b3d9d5
...@@ -90,6 +90,7 @@ int debug_log(struct bat_priv *bat_priv, char *fmt, ...) ...@@ -90,6 +90,7 @@ int debug_log(struct bat_priv *bat_priv, char *fmt, ...)
static int log_open(struct inode *inode, struct file *file) static int log_open(struct inode *inode, struct file *file)
{ {
nonseekable_open(inode, file);
file->private_data = inode->i_private; file->private_data = inode->i_private;
inc_module_count(); inc_module_count();
return 0; return 0;
...@@ -174,6 +175,7 @@ static const struct file_operations log_fops = { ...@@ -174,6 +175,7 @@ static const struct file_operations log_fops = {
.release = log_release, .release = log_release,
.read = log_read, .read = log_read,
.poll = log_poll, .poll = log_poll,
.llseek = no_llseek,
}; };
static int debug_log_setup(struct bat_priv *bat_priv) static int debug_log_setup(struct bat_priv *bat_priv)
......
...@@ -45,6 +45,8 @@ static int bat_socket_open(struct inode *inode, struct file *file) ...@@ -45,6 +45,8 @@ static int bat_socket_open(struct inode *inode, struct file *file)
unsigned int i; unsigned int i;
struct socket_client *socket_client; struct socket_client *socket_client;
nonseekable_open(inode, file);
socket_client = kmalloc(sizeof(struct socket_client), GFP_KERNEL); socket_client = kmalloc(sizeof(struct socket_client), GFP_KERNEL);
if (!socket_client) if (!socket_client)
...@@ -283,6 +285,7 @@ static const struct file_operations fops = { ...@@ -283,6 +285,7 @@ static const struct file_operations fops = {
.read = bat_socket_read, .read = bat_socket_read,
.write = bat_socket_write, .write = bat_socket_write,
.poll = bat_socket_poll, .poll = bat_socket_poll,
.llseek = no_llseek,
}; };
int bat_socket_setup(struct bat_priv *bat_priv) int bat_socket_setup(struct bat_priv *bat_priv)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册