Skip to content

Commit

Permalink
ipv6: add missing ireq_net & ir_cookie initializations
Browse files Browse the repository at this point in the history
I forgot to update dccp_v6_conn_request() & cookie_v6_check().
They both need to set ireq->ireq_net and ireq->ir_cookie

Lets clear ireq->ir_cookie in inet_reqsk_alloc()

Signed-off-by: Eric Dumazet <edumazet@google.com>
Fixes: 33cf7c9 ("net: add real socket cookies")
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Mar 13, 2015
1 parent 54720df commit bd337c5
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions include/net/inet_sock.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ static inline struct request_sock *inet_reqsk_alloc(struct request_sock_ops *ops
if (req != NULL) {
kmemcheck_annotate_bitfield(ireq, flags);
ireq->opt = NULL;
atomic64_set(&ireq->ir_cookie, 0);
}

return req;
Expand Down
1 change: 0 additions & 1 deletion net/dccp/ipv4.c
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,6 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
ireq->ir_loc_addr = ip_hdr(skb)->daddr;
ireq->ir_rmt_addr = ip_hdr(skb)->saddr;
write_pnet(&ireq->ireq_net, sock_net(sk));
atomic64_set(&ireq->ir_cookie, 0);

/*
* Step 3: Process LISTEN state
Expand Down
1 change: 1 addition & 0 deletions net/dccp/ipv6.c
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ static int dccp_v6_conn_request(struct sock *sk, struct sk_buff *skb)
ireq = inet_rsk(req);
ireq->ir_v6_rmt_addr = ipv6_hdr(skb)->saddr;
ireq->ir_v6_loc_addr = ipv6_hdr(skb)->daddr;
write_pnet(&ireq->ireq_net, sock_net(sk));

if (ipv6_opt_accepted(sk, skb, IP6CB(skb)) ||
np->rxopt.bits.rxinfo || np->rxopt.bits.rxoinfo ||
Expand Down
1 change: 0 additions & 1 deletion net/ipv4/tcp_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -5966,7 +5966,6 @@ int tcp_conn_request(struct request_sock_ops *rsk_ops,
tmp_opt.tstamp_ok = tmp_opt.saw_tstamp;
tcp_openreq_init(req, &tmp_opt, skb, sk);
write_pnet(&inet_rsk(req)->ireq_net, sock_net(sk));
atomic64_set(&inet_rsk(req)->ir_cookie, 0);

af_ops->init_req(req, sk, skb);

Expand Down
1 change: 1 addition & 0 deletions net/ipv6/syncookies.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)
ireq = inet_rsk(req);
treq = tcp_rsk(req);
treq->listener = NULL;
write_pnet(&ireq->ireq_net, sock_net(sk));

if (security_inet_conn_request(sk, skb, req))
goto out_free;
Expand Down

0 comments on commit bd337c5

Please sign in to comment.