Thread (12 messages) flat view 12 messages, 3 authors, 2012-07-05

Re: [PATCH net-next 1/2] ipv6: remove unnecessary codes in tcp_ipv6.c

From: RongQing Li <hidden>
Date: 2012-07-02 05:23:10

2012/7/2 David Miller [off-list ref]:
From: roy.qing.li@gmail.com
Date: Mon,  2 Jul 2012 11:18:59 +0800
quoted
-     if (opt) {
-             newnp->opt = ipv6_dup_options(newsk, opt);
-             if (opt != np->opt)
-                     sock_kfree_s(sk, opt, opt->tot_len);
This is bogus, if we copy the options into a new copy in
ipv6_dup_options() we have to free the old one or else we
leak it.
Do you mean I should free newnp->opt firstly ?

If I understand it right, I think we do not need to free it. the
process is below:

newsk = tcp_v4_syn_recv_sock(sk, skb, req, dst);
..
newnp = inet6_sk(newsk);
..
memcpy(newnp, np, sizeof(struct ipv6_pinfo));
..
newnp->opt         = NULL;

So newnp->opt is not a effective memory.


Thanks.
-Roy
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help