lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20120701.223736.2073666097053189601.davem@davemloft.net>
Date:	Sun, 01 Jul 2012 22:37:36 -0700 (PDT)
From:	David Miller <davem@...emloft.net>
To:	roy.qing.li@...il.com
Cc:	netdev@...r.kernel.org
Subject: Re: [PATCH net-next 1/2] ipv6: remove unnecessary codes in
 tcp_ipv6.c

From: RongQing Li <roy.qing.li@...il.com>
Date: Mon, 2 Jul 2012 13:23:09 +0800

> 2012/7/2 David Miller <davem@...emloft.net>:
>> From: roy.qing.li@...il.com
>> Date: Mon,  2 Jul 2012 11:18:59 +0800
>>
>>> -     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.

ipv6_dup_options() allocates new memory for the options and this call
statement assigns that new pointer to np->opt.

If you do not free the old (before ipv6_dup_options()) np->opt memory
here, it is lost forever.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ