summary refs log tree commit diff
path: root/drivers/net/tun.c
diff options
context:
space:
mode:
authorJoerg Roedel <jroedel@suse.de>2019-06-24 10:23:16 +0200
committerJoerg Roedel <jroedel@suse.de>2019-06-24 10:23:16 +0200
commitceedd5f74d8cfe34db4e654a7808e3c5de40d6f5 (patch)
treee19c18292231202e9cd8d484ee43f46b2c9c9ad1 /drivers/net/tun.c
parent1b961423158caaae49d3900b7c9c37477bbfa9b3 (diff)
parent4b972a01a7da614b4796475f933094751a295a2f (diff)
downloadlinux-ceedd5f74d8cfe34db4e654a7808e3c5de40d6f5.tar.gz
Merge tag 'v5.2-rc6' into generic-dma-ops
Linux 5.2-rc6
Diffstat (limited to 'drivers/net/tun.c')
-rw-r--r--drivers/net/tun.c30
1 files changed, 10 insertions, 20 deletions
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index abae165dcca5..d7c55e0fa8f4 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -1,17 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  TUN - Universal TUN/TAP device driver.
  *  Copyright (C) 1999-2002 Maxim Krasnyansky <maxk@qualcomm.com>
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
  *  $Id: tun.c,v 1.15 2002/03/01 02:44:24 maxk Exp $
  */
 
@@ -1023,18 +1014,8 @@ static void tun_net_uninit(struct net_device *dev)
 /* Net device open. */
 static int tun_net_open(struct net_device *dev)
 {
-	struct tun_struct *tun = netdev_priv(dev);
-	int i;
-
 	netif_tx_start_all_queues(dev);
 
-	for (i = 0; i < tun->numqueues; i++) {
-		struct tun_file *tfile;
-
-		tfile = rtnl_dereference(tun->tfiles[i]);
-		tfile->socket.sk->sk_write_space(tfile->socket.sk);
-	}
-
 	return 0;
 }
 
@@ -3643,6 +3624,7 @@ static int tun_device_event(struct notifier_block *unused,
 {
 	struct net_device *dev = netdev_notifier_info_to_dev(ptr);
 	struct tun_struct *tun = netdev_priv(dev);
+	int i;
 
 	if (dev->rtnl_link_ops != &tun_link_ops)
 		return NOTIFY_DONE;
@@ -3652,6 +3634,14 @@ static int tun_device_event(struct notifier_block *unused,
 		if (tun_queue_resize(tun))
 			return NOTIFY_BAD;
 		break;
+	case NETDEV_UP:
+		for (i = 0; i < tun->numqueues; i++) {
+			struct tun_file *tfile;
+
+			tfile = rtnl_dereference(tun->tfiles[i]);
+			tfile->socket.sk->sk_write_space(tfile->socket.sk);
+		}
+		break;
 	default:
 		break;
 	}