ipv4: avoid to double release dst in tcp_v4_connect
Subsystems (3)
PATCH 1/1 ipv4: avoid to double release dst in tcp_v4_connect
From: RongQing.Li <[email protected]>
When tcp_connect failed in tcp_v4_connect, the dst will be released in error handler of tcp_v4_connect, but dst has been set to sk->sk_dst_cache which will be released again when destroy this sk.
--- net/ipv4/tcp_ipv4.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
net/ipv4/tcp_ipv4.c +3 -1
@@ -263,8 +263,10 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) err =tcp_connect (sk); rt =NULL ; -if (err) +if (err) { + sk->sk_dst_cache =NULL ; goto failure; + }return 0 ;
Signature · 1 line
1.7.1
David Miller
maintainerFrom: [email protected]
Date: Thu, 17 Nov 2011 16:33:48 +0800
Quoted 8 lines
From: RongQing.Li <[email protected]>
When
tcp_connectfailed intcp_v4_connect, the dst will be released in error handler oftcp_v4_connect, but dst has been set tosk->sk_dst_cachewhich will be released again when destroy this sk.Signed-off-by RongQing.Li <[email protected]>
We set 'rt' to NULL at these statements specifically to handle this situation, ip_rt_put(NULL) will do nothing.
I don't think this change is necessary.
2011/11/18 David Miller <[email protected]>:
Quoted 5 lines
We set 'rt' to NULL at these statements specifically to handle this situation,
ip_rt_put(NULL)will do nothing.I don't think this change is necessary.
Yes, I am wrong, thank you.