netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paul Gortmaker <paul.gortmaker@windriver.com>
To: <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>, <allan.stephens@windriver.com>,
	<jon.maloy@ericsson.com>, <erik.hugne@ericsson.com>,
	<ying.xue@windriver.com>
Subject: [PATCH net-next 08/10] tipc: Enhance error checking of published names
Date: Mon, 30 Apr 2012 18:37:06 -0400	[thread overview]
Message-ID: <1335825428-16053-9-git-send-email-paul.gortmaker@windriver.com> (raw)
In-Reply-To: <1335825428-16053-1-git-send-email-paul.gortmaker@windriver.com>

From: Allan Stephens <allan.stephens@windriver.com>

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>
---
 net/tipc/name_table.c |    7 ++++---
 net/tipc/port.c       |    4 ----
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c
index 4222121..4de58de 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 4aede40..e684170 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;
-- 
1.7.9.6

  parent reply	other threads:[~2012-04-30 22:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-30 22:36 [PATCH net-next 00/10] tipc: last batch from the sourceforge queue Paul Gortmaker
2012-04-30 22:36 ` [PATCH net-next 01/10] tipc: Optimize re-initialization of configuration service Paul Gortmaker
2012-04-30 22:37 ` [PATCH net-next 02/10] tipc: Optimize initialization " Paul Gortmaker
2012-04-30 22:37 ` [PATCH net-next 03/10] tipc: Optimize termination " Paul Gortmaker
2012-04-30 22:37 ` [PATCH net-next 04/10] tipc: Enhance re-initialization of network topology service Paul Gortmaker
2012-04-30 22:37 ` [PATCH net-next 05/10] tipc: Optimize initialization " Paul Gortmaker
2012-04-30 22:37 ` [PATCH net-next 06/10] tipc: remove redundant memset and stale comment from subscr.c Paul Gortmaker
2012-04-30 22:37 ` [PATCH net-next 07/10] tipc: Create helper routine to delete unused name sequence structure Paul Gortmaker
2012-04-30 22:37 ` Paul Gortmaker [this message]
2012-04-30 22:37 ` [PATCH net-next 09/10] tipc: Reject payload messages with invalid message type Paul Gortmaker
2012-04-30 22:37 ` [PATCH net-next 10/10] tipc: compress out gratuitous extra carriage returns Paul Gortmaker
2012-05-01  1:45 ` [PATCH net-next 00/10] tipc: last batch from the sourceforge queue David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1335825428-16053-9-git-send-email-paul.gortmaker@windriver.com \
    --to=paul.gortmaker@windriver.com \
    --cc=allan.stephens@windriver.com \
    --cc=davem@davemloft.net \
    --cc=erik.hugne@ericsson.com \
    --cc=jon.maloy@ericsson.com \
    --cc=netdev@vger.kernel.org \
    --cc=ying.xue@windriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).