netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Max Krasnyansky <maxk@qualcomm.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, Max Krasnyansky <maxk@qualcomm.com>
Subject: [TIPC] Properly mask header fields
Date: Thu, 15 Feb 2007 22:27:33 -0800	[thread overview]
Message-ID: <1171607254637-git-send-email-maxk@qualcomm.com> (raw)

TIPC code is a bit inconsistent in masking out upper bits of various
message fields when packing them into the headers. For the most part
things seem to be ok but we happened to hit a corner case in our labs
when broadcast counter reached certain value (don't remember exact
details) and was messing up status bits in the header. At which point
the link was busted and required a reset to bring it back up.
It's much safer to apply proper mask in the function that does the
actual packing rather than doing it all over the place, and missing a
few ;-).

Signed-off-by: Max Krasnyansky <maxk@qualcomm.com>
---
 net/tipc/msg.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/tipc/msg.h b/net/tipc/msg.h
index 6699aaf..4e681c8 100644
--- a/net/tipc/msg.h
+++ b/net/tipc/msg.h
@@ -72,7 +72,7 @@ static inline void msg_set_bits(struct tipc_msg *m, u32 w,
 				u32 pos, u32 mask, u32 val)
 {
 	u32 word = msg_word(m,w) & ~(mask << pos);
-	msg_set_word(m, w, (word |= (val << pos)));
+	msg_set_word(m, w, (word |= ((val & mask) << pos)));
 }
 
 /* 
-- 
1.4.4.2


             reply	other threads:[~2007-02-16  7:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-16  6:27 Max Krasnyansky [this message]
2007-02-16  6:27 ` [TIPC] Missing null check in the socket code Max Krasnyansky
2007-02-20 18:48   ` Max Krasnyansky
2007-02-21 14:02     ` Jon Maloy (QB/EMC)
2007-02-21 21:22       ` Max Krasnyansky
2007-02-20 18:47 ` [TIPC] Properly mask header fields Max Krasnyansky

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=1171607254637-git-send-email-maxk@qualcomm.com \
    --to=maxk@qualcomm.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /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).