netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Paul Moore" <paul.moore@hp.com>
To: netdev@vger.kernel.org
Subject: [PATCH] INET: fix incorrect "inet_sock->is_icsk" assignment
Date: Thu, 04 Jan 2007 15:04:31 -0500	[thread overview]
Message-ID: <20070104200437.008980288@hp.com> (raw)
In-Reply-To: 20070104200430.149943972@hp.com

[-- Attachment #1: network-fix_icsk_assignment --]
[-- Type: text/plain, Size: 1544 bytes --]

From: Paul Moore <paul.moore@hp.com>

The inet_create() and inet6_create() functions incorrectly set the
inet_sock->is_icsk field.  Both functions assume that the is_icsk field is
large enough to hold at least a INET_PROTOSW_ICSK value when it is actually
only a single bit.  This patch corrects the assignment by doing a boolean
comparison whose result will safely fit into a single bit field.

Signed-off-by: Paul Moore <paul.moore@hp.com>
---
 net/ipv4/af_inet.c  |    2 +-
 net/ipv6/af_inet6.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Index: net-2.6.20_bugfix_2/net/ipv4/af_inet.c
===================================================================
--- net-2.6.20_bugfix_2.orig/net/ipv4/af_inet.c
+++ net-2.6.20_bugfix_2/net/ipv4/af_inet.c
@@ -305,7 +305,7 @@ lookup_protocol:
 		sk->sk_reuse = 1;
 
 	inet = inet_sk(sk);
-	inet->is_icsk = INET_PROTOSW_ICSK & answer_flags;
+	inet->is_icsk = (INET_PROTOSW_ICSK & answer_flags) == INET_PROTOSW_ICSK;
 
 	if (SOCK_RAW == sock->type) {
 		inet->num = protocol;
Index: net-2.6.20_bugfix_2/net/ipv6/af_inet6.c
===================================================================
--- net-2.6.20_bugfix_2.orig/net/ipv6/af_inet6.c
+++ net-2.6.20_bugfix_2/net/ipv6/af_inet6.c
@@ -171,7 +171,7 @@ lookup_protocol:
 		sk->sk_reuse = 1;
 
 	inet = inet_sk(sk);
-	inet->is_icsk = INET_PROTOSW_ICSK & answer_flags;
+	inet->is_icsk = (INET_PROTOSW_ICSK & answer_flags) == INET_PROTOSW_ICSK;
 
 	if (SOCK_RAW == sock->type) {
 		inet->num = protocol;

--
paul moore
linux security @ hp


       reply	other threads:[~2007-01-04 23:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20070104200430.149943972@hp.com>
2007-01-04 20:04 ` Paul Moore [this message]
2007-01-05  0:57   ` [PATCH] INET: fix incorrect "inet_sock->is_icsk" assignment David Miller
2007-01-05  2:32     ` Arnaldo Carvalho de Melo
2007-01-05  5:42       ` David Miller
2007-01-08 13:25   ` Jarek Poplawski
2007-01-08 14:47     ` Paul Moore
2007-01-09  8:43       ` Jarek Poplawski
2007-01-09 14:26         ` Paul Moore
2007-01-09 14:52           ` Arnaldo Carvalho de Melo
2007-01-10 10:01           ` Jarek Poplawski
2007-01-10 13:13             ` Paul Moore
2007-01-10 13:31               ` Jarek Poplawski

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=20070104200437.008980288@hp.com \
    --to=paul.moore@hp.com \
    --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).