Re: [Patch net v2] tun: fix a memory leak for tfile->tx_array

2018-01-15 Thread Cong Wang
On Sun, Jan 14, 2018 at 11:07 PM, Jason Wang wrote: > > > On 2018年01月14日 01:31, Cong Wang wrote: >> >> On Thu, Jan 11, 2018 at 2:16 AM, Jason Wang wrote: >>> >>> It looks to me what is actual missed is the cleanups tun_detach_all(). >>> For >>> me the only case that could leak is >>> >>> open >>>

Re: [Patch net v2] tun: fix a memory leak for tfile->tx_array

2018-01-14 Thread Jason Wang
On 2018年01月14日 01:31, Cong Wang wrote: On Thu, Jan 11, 2018 at 2:16 AM, Jason Wang wrote: It looks to me what is actual missed is the cleanups tun_detach_all(). For me the only case that could leak is open attach ip link del link dev tap0 close or another set_iff() So in this case, clean du

Re: [Patch net v2] tun: fix a memory leak for tfile->tx_array

2018-01-13 Thread Cong Wang
On Thu, Jan 11, 2018 at 2:16 AM, Jason Wang wrote: > > It looks to me what is actual missed is the cleanups tun_detach_all(). For > me the only case that could leak is > > open > attach > ip link del link dev tap0 > close or another set_iff() > > So in this case, clean during close is not sufficie

Re: [Patch net v2] tun: fix a memory leak for tfile->tx_array

2018-01-11 Thread Jason Wang
On 2018年01月11日 02:51, Cong Wang wrote: tfile->tun could be detached before we close the tun fd, via tun_detach_all(), so it should not be used to check for tfile->tx_array. As Jason suggested, we probably have to clean it up unconditionally, but this requires to check if it is initialized or n

[Patch net v2] tun: fix a memory leak for tfile->tx_array

2018-01-10 Thread Cong Wang
tfile->tun could be detached before we close the tun fd, via tun_detach_all(), so it should not be used to check for tfile->tx_array. As Jason suggested, we probably have to clean it up unconditionally, but this requires to check if it is initialized or not. Currently skb_array_cleanup() doesn't h