Skip to content

Commit

Permalink
tproxy: fixe a possible read from an invalid location in the socket m…
Browse files Browse the repository at this point in the history
…atch

TIME_WAIT sockets need to be handled specially, and the socket match
casted inet_timewait_sock instances to inet_sock, which are not
compatible.

Handle this special case by checking sk->sk_state.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Balazs Scheidler authored and David S. Miller committed Dec 8, 2008
1 parent 0a0755c commit c49b9f2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/netfilter/xt_socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ socket_mt(const struct sk_buff *skb, const struct xt_match_param *par)
sk = nf_tproxy_get_sock_v4(dev_net(skb->dev), protocol,
saddr, daddr, sport, dport, par->in, false);
if (sk != NULL) {
bool wildcard = (inet_sk(sk)->rcv_saddr == 0);
bool wildcard = (sk->sk_state != TCP_TIME_WAIT && inet_sk(sk)->rcv_saddr == 0);

nf_tproxy_put_sock(sk);
if (wildcard)
Expand Down

0 comments on commit c49b9f2

Please sign in to comment.