hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/net/batman-adv/icmp_socket.c
....@@ -1,19 +1,7 @@
11 // SPDX-License-Identifier: GPL-2.0
2
-/* Copyright (C) 2007-2018 B.A.T.M.A.N. contributors:
2
+/* Copyright (C) 2007-2020 B.A.T.M.A.N. contributors:
33 *
44 * Marek Lindner
5
- *
6
- * This program is free software; you can redistribute it and/or
7
- * modify it under the terms of version 2 of the GNU General Public
8
- * License as published by the Free Software Foundation.
9
- *
10
- * This program is distributed in the hope that it will be useful, but
11
- * WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
- * General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License
16
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
175 */
186
197 #include "icmp_socket.h"
....@@ -47,6 +35,7 @@
4735 #include <linux/wait.h>
4836 #include <uapi/linux/batadv_packet.h>
4937
38
+#include "debugfs.h"
5039 #include "hard-interface.h"
5140 #include "log.h"
5241 #include "originator.h"
....@@ -74,7 +63,9 @@
7463 if (!try_module_get(THIS_MODULE))
7564 return -EBUSY;
7665
77
- nonseekable_open(inode, file);
66
+ batadv_debugfs_deprecated(file, "");
67
+
68
+ stream_open(inode, file);
7869
7970 socket_client = kmalloc(sizeof(*socket_client), GFP_KERNEL);
8071 if (!socket_client) {
....@@ -143,9 +134,6 @@
143134
144135 if (!buf || count < sizeof(struct batadv_icmp_packet))
145136 return -EINVAL;
146
-
147
- if (!access_ok(VERIFY_WRITE, buf, count))
148
- return -EFAULT;
149137
150138 error = wait_event_interruptible(socket_client->queue_wait,
151139 socket_client->queue_len);
....@@ -323,25 +311,11 @@
323311 /**
324312 * batadv_socket_setup() - Create debugfs "socket" file
325313 * @bat_priv: the bat priv with all the soft interface information
326
- *
327
- * Return: 0 on success or negative error number in case of failure
328314 */
329
-int batadv_socket_setup(struct batadv_priv *bat_priv)
315
+void batadv_socket_setup(struct batadv_priv *bat_priv)
330316 {
331
- struct dentry *d;
332
-
333
- if (!bat_priv->debug_dir)
334
- goto err;
335
-
336
- d = debugfs_create_file(BATADV_ICMP_SOCKET, 0600, bat_priv->debug_dir,
337
- bat_priv, &batadv_fops);
338
- if (!d)
339
- goto err;
340
-
341
- return 0;
342
-
343
-err:
344
- return -ENOMEM;
317
+ debugfs_create_file(BATADV_ICMP_SOCKET, 0600, bat_priv->debug_dir,
318
+ bat_priv, &batadv_fops);
345319 }
346320
347321 /**