diff options
author | Paul Moore <paul.moore@hp.com> | 2007-01-04 19:56:46 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-01-09 03:29:51 -0500 |
commit | cbbd7d4f36a61631f8c0d73be43df985d1e7d6a6 (patch) | |
tree | 53bc30da9db871484d137e69aebfcfd29dfda4ed /net | |
parent | efa06708fe77190f31bed5c3cb5da49e211240f5 (diff) |
[INET]: Fix incorrect "inet_sock->is_icsk" assignment.
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>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv4/af_inet.c | 2 | ||||
-rw-r--r-- | net/ipv6/af_inet6.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 1144900d37f6..d60fd7321e63 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c | |||
@@ -305,7 +305,7 @@ lookup_protocol: | |||
305 | sk->sk_reuse = 1; | 305 | sk->sk_reuse = 1; |
306 | 306 | ||
307 | inet = inet_sk(sk); | 307 | inet = inet_sk(sk); |
308 | inet->is_icsk = INET_PROTOSW_ICSK & answer_flags; | 308 | inet->is_icsk = (INET_PROTOSW_ICSK & answer_flags) == INET_PROTOSW_ICSK; |
309 | 309 | ||
310 | if (SOCK_RAW == sock->type) { | 310 | if (SOCK_RAW == sock->type) { |
311 | inet->num = protocol; | 311 | inet->num = protocol; |
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c index e5cd83b2205d..832a5e6e2d7e 100644 --- a/net/ipv6/af_inet6.c +++ b/net/ipv6/af_inet6.c | |||
@@ -171,7 +171,7 @@ lookup_protocol: | |||
171 | sk->sk_reuse = 1; | 171 | sk->sk_reuse = 1; |
172 | 172 | ||
173 | inet = inet_sk(sk); | 173 | inet = inet_sk(sk); |
174 | inet->is_icsk = INET_PROTOSW_ICSK & answer_flags; | 174 | inet->is_icsk = (INET_PROTOSW_ICSK & answer_flags) == INET_PROTOSW_ICSK; |
175 | 175 | ||
176 | if (SOCK_RAW == sock->type) { | 176 | if (SOCK_RAW == sock->type) { |
177 | inet->num = protocol; | 177 | inet->num = protocol; |