[INET]: Fix incorrect "inet_sock->is_icsk" assignment.
authorPaul Moore <paul.moore@hp.com>
Fri, 5 Jan 2007 00:56:46 +0000 (16:56 -0800)
committerDavid S. Miller <davem@sunset.davemloft.net>
Tue, 9 Jan 2007 08:29:51 +0000 (00:29 -0800)
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/af_inet.c
net/ipv6/af_inet6.c

index 1144900d37f6dbd6b91b19e307770db265d9c18c..d60fd7321e6363f98a1c09bbfb2a3cc7d9853415 100644 (file)
@@ -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 e5cd83b2205d41e9a2689224b12d4d8dbfaec2e9..832a5e6e2d7e6270808bbfc70a26eddba49250a6 100644 (file)
@@ -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;