hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/net/batman-adv/tp_meter.c
....@@ -1,19 +1,7 @@
11 // SPDX-License-Identifier: GPL-2.0
2
-/* Copyright (C) 2012-2018 B.A.T.M.A.N. contributors:
2
+/* Copyright (C) 2012-2020 B.A.T.M.A.N. contributors:
33 *
44 * Edo Monticelli, Antonio Quartulli
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 "tp_meter.h"
....@@ -33,6 +21,7 @@
3321 #include <linux/kernel.h>
3422 #include <linux/kref.h>
3523 #include <linux/kthread.h>
24
+#include <linux/limits.h>
3625 #include <linux/list.h>
3726 #include <linux/netdevice.h>
3827 #include <linux/param.h>
....@@ -77,7 +66,7 @@
7766
7867 /**
7968 * BATADV_TP_MAX_RTO - Maximum sender timeout. If the sender RTO gets beyond
80
- * such amound of milliseconds, the receiver is considered unreachable and the
69
+ * such amount of milliseconds, the receiver is considered unreachable and the
8170 * connection is killed
8271 */
8372 #define BATADV_TP_MAX_RTO 30000
....@@ -119,10 +108,10 @@
119108 * batadv_tp_cwnd() - compute the new cwnd size
120109 * @base: base cwnd size value
121110 * @increment: the value to add to base to get the new size
122
- * @min: minumim cwnd value (usually MSS)
111
+ * @min: minimum cwnd value (usually MSS)
123112 *
124
- * Return the new cwnd size and ensures it does not exceed the Advertised
125
- * Receiver Window size. It is wrap around safe.
113
+ * Return the new cwnd size and ensure it does not exceed the Advertised
114
+ * Receiver Window size. It is wrapped around safely.
126115 * For details refer to Section 3.1 of RFC5681
127116 *
128117 * Return: new congestion window size in bytes
....@@ -265,7 +254,7 @@
265254 * @dst: the other endpoint MAC address to look for
266255 *
267256 * Look for a tp_vars object matching dst as end_point and return it after
268
- * having incremented the refcounter. Return NULL is not found
257
+ * having increment the refcounter. Return NULL is not found
269258 *
270259 * Return: matching tp_vars or NULL when no tp_vars with @dst was found
271260 */
....@@ -302,7 +291,7 @@
302291 * @session: session identifier
303292 *
304293 * Look for a tp_vars object matching dst as end_point, session as tp meter
305
- * session and return it after having incremented the refcounter. Return NULL
294
+ * session and return it after having increment the refcounter. Return NULL
306295 * is not found
307296 *
308297 * Return: matching tp_vars or NULL when no tp_vars was found
....@@ -368,6 +357,9 @@
368357 */
369358 static void batadv_tp_vars_put(struct batadv_tp_vars *tp_vars)
370359 {
360
+ if (!tp_vars)
361
+ return;
362
+
371363 kref_put(&tp_vars->refcount, batadv_tp_vars_release);
372364 }
373365