tuntap: fix leaking reference count
commitdd38bd853082355641d0034aaf368e13ef2438f8
authorJason Wang <jasowang@redhat.com>
Fri, 11 Jan 2013 16:59:34 +0000 (11 16:59 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sat, 12 Jan 2013 03:42:02 +0000 (11 19:42 -0800)
treed30449d71cc6c1cbe9d5cc412c2046f4c1527c43
parent7c0c3b1a8a175437991ccc898ed66ec5e4a96208
tuntap: fix leaking reference count

Reference count leaking of both module and sock were found:

- When a detached file were closed, its sock refcnt from device were not
  released, solving this by add the sock_put().
- The module were hold or drop unconditionally in TUNSETPERSIST, which means we
  if we set the persist flag for N times, we need unset it for another N
  times. Solving this by only hold or drop an reference when there's a flag
  change and also drop the reference count when the persist device is deleted.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/tun.c