Commit cbbd7d4f authored by Paul Moore's avatar Paul Moore Committed by David S. Miller

[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: default avatarPaul Moore <paul.moore@hp.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent efa06708
...@@ -305,7 +305,7 @@ lookup_protocol: ...@@ -305,7 +305,7 @@ lookup_protocol:
sk->sk_reuse = 1; sk->sk_reuse = 1;
inet = inet_sk(sk); 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) { if (SOCK_RAW == sock->type) {
inet->num = protocol; inet->num = protocol;
......
...@@ -171,7 +171,7 @@ lookup_protocol: ...@@ -171,7 +171,7 @@ lookup_protocol:
sk->sk_reuse = 1; sk->sk_reuse = 1;
inet = inet_sk(sk); 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) { if (SOCK_RAW == sock->type) {
inet->num = protocol; inet->num = protocol;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment