* [PATCH] ipv4: avoid to double release dst in tcp_v4_connect
@ 2011-11-17 8:33 roy.qing.li
2011-11-17 21:56 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: roy.qing.li @ 2011-11-17 8:33 UTC (permalink / raw)
To: netdev
From: RongQing.Li <roy.qing.li@gmail.com>
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.
Signed-off-by: RongQing.Li <roy.qing.li@gmail.com>
---
net/ipv4/tcp_ipv4.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index a744315..adc2992 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -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;
--
1.7.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] ipv4: avoid to double release dst in tcp_v4_connect
2011-11-17 8:33 [PATCH] ipv4: avoid to double release dst in tcp_v4_connect roy.qing.li
@ 2011-11-17 21:56 ` David Miller
2011-11-17 23:54 ` RongQing Li
0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2011-11-17 21:56 UTC (permalink / raw)
To: roy.qing.li; +Cc: netdev
From: roy.qing.li@gmail.com
Date: Thu, 17 Nov 2011 16:33:48 +0800
> From: RongQing.Li <roy.qing.li@gmail.com>
>
> 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.
>
> Signed-off-by: RongQing.Li <roy.qing.li@gmail.com>
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-11-17 23:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-17 8:33 [PATCH] ipv4: avoid to double release dst in tcp_v4_connect roy.qing.li
2011-11-17 21:56 ` David Miller
2011-11-17 23:54 ` RongQing Li
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).