summaryrefslogtreecommitdiff
path: root/net/tipc/link.c
diff options
context:
space:
mode:
authorAllan Stephens <Allan.Stephens@windriver.com>2011-01-18 13:24:55 -0500
committerPaul Gortmaker <paul.gortmaker@windriver.com>2011-02-23 18:05:09 -0500
commit5413b4c6c07b659e52c84a4e40d897b32b89834f (patch)
treea0f108cc7396f0a715ed36cd1d6b2636c52798b1 /net/tipc/link.c
parent3f8dd9446e66f2a982ddcff38e4705cfe93eeec6 (diff)
tipc: Improve handling of invalid link tolerance values
Enhances TIPC link code to ignore an invalid link tolerance value contained in an incoming LINK_PROTOCOL message, rather than processing the value and potentially causing a divide-by-zero error. Also add a compile-time check that catches attempts to redefine TIPC's minimum link tolerance value in a manner that might result in the same divide-by-zero error at run-time. Signed-off-by: Allan Stephens <Allan.Stephens@windriver.com> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Diffstat (limited to 'net/tipc/link.c')
-rw-r--r--net/tipc/link.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/tipc/link.c b/net/tipc/link.c
index 1c5c53a81531..3c1c28cdbaa4 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -2617,6 +2617,9 @@ static void link_check_defragm_bufs(struct link *l_ptr)
static void link_set_supervision_props(struct link *l_ptr, u32 tolerance)
{
+ if ((tolerance < TIPC_MIN_LINK_TOL) || (tolerance > TIPC_MAX_LINK_TOL))
+ return;
+
l_ptr->tolerance = tolerance;
l_ptr->continuity_interval =
((tolerance / 4) > 500) ? 500 : tolerance / 4;