tuntap: correctly handle error in tun_set_iff()
authorJason Wang <jasowang@redhat.com>
Wed, 11 Sep 2013 10:09:48 +0000 (18:09 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 13 Oct 2013 23:08:29 +0000 (16:08 -0700)
commita81a02460bdf054ca0c60c5aed29941f7134092d
treeaaf3e865f6107a1dab96f3ad059754a9cf1e84b3
parente66bdd7106911886aebf118e1c1aebb5a26d0752
tuntap: correctly handle error in tun_set_iff()

[ Upstream commit 662ca437e714caaab855b12415d6ffd815985bc0 ]

Commit c8d68e6be1c3b242f1c598595830890b65cea64a
(tuntap: multiqueue support) only call free_netdev() on error in
tun_set_iff(). This causes several issues:

- memory of tun security were leaked
- use after free since the flow gc timer was not deleted and the tfile
  were not detached

This patch solves the above issues.

Reported-by: Wannes Rombouts <wannes.rombouts@epitech.eu>
Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/tun.c