summaryrefslogtreecommitdiffstats
path: root/net/tipc
diff options
context:
space:
mode:
authorAllan Stephens <allan.stephens@windriver.com>2012-04-26 23:57:17 +0200
committerPaul Gortmaker <paul.gortmaker@windriver.com>2012-04-27 00:15:48 +0200
commit8f1778969359a71f398c9ac6d3a9a3e61439b466 (patch)
tree09a5003c9b116cdde9f12acec508067ee8215333 /net/tipc
parenttipc: Create helper routine to delete unused name sequence structure (diff)
downloadlinux-8f1778969359a71f398c9ac6d3a9a3e61439b466.tar.xz
linux-8f1778969359a71f398c9ac6d3a9a3e61439b466.zip
tipc: Enhance error checking of published names
Consolidates validation of scope and name sequence range values into a single routine where it applies both to local name publications and to name publications issued by other nodes in the network. This change means that the scope value for non-local publications is now validated and the name sequence range for local publications is now validated only once. Additionally, a publication attempt that fails validation now creates an entry in the system log file only if debugging capabilities have been enabled; this prevents the system log from being cluttered up with messages caused by a defective application or network node. Signed-off-by: Allan Stephens <allan.stephens@windriver.com> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Diffstat (limited to 'net/tipc')
-rw-r--r--net/tipc/name_table.c7
-rw-r--r--net/tipc/port.c4
2 files changed, 4 insertions, 7 deletions
diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c
index 42221219275c..4de58dece9b2 100644
--- a/net/tipc/name_table.c
+++ b/net/tipc/name_table.c
@@ -516,9 +516,10 @@ struct publication *tipc_nametbl_insert_publ(u32 type, u32 lower, u32 upper,
{
struct name_seq *seq = nametbl_find_seq(type);
- if (lower > upper) {
- warn("Failed to publish illegal {%u,%u,%u}\n",
- type, lower, upper);
+ if ((scope < TIPC_ZONE_SCOPE) || (scope > TIPC_NODE_SCOPE) ||
+ (lower > upper)) {
+ dbg("Failed to publish illegal {%u,%u,%u} with scope %u\n",
+ type, lower, upper, scope);
return NULL;
}
diff --git a/net/tipc/port.c b/net/tipc/port.c
index 4aede40e592f..e6841706967c 100644
--- a/net/tipc/port.c
+++ b/net/tipc/port.c
@@ -992,10 +992,6 @@ int tipc_publish(u32 ref, unsigned int scope, struct tipc_name_seq const *seq)
if (p_ptr->connected)
goto exit;
- if (seq->lower > seq->upper)
- goto exit;
- if ((scope < TIPC_ZONE_SCOPE) || (scope > TIPC_NODE_SCOPE))
- goto exit;
key = ref + p_ptr->pub_count + 1;
if (key == ref) {
res = -EADDRINUSE;