diff options
author | Jason Wang <jasowang@redhat.com> | 2013-04-22 16:40:39 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-04-25 01:48:23 -0400 |
commit | e8dbad66ef56074eadb41ed5998acd2320447018 (patch) | |
tree | dc9a72436ced43c117bfe447dea24570586f178b /drivers/net | |
parent | 5ffedc6ed3d066f5c0d2c2106f9081170b3d24fa (diff) |
tuntap: correct the return value in tun_set_iff()
commit (3be8fbab tuntap: fix error return code in tun_set_iff()) breaks the
creation of multiqueue tuntap since it forbids to create more than one queues
for a multiqueue tuntap device. We need return 0 instead -EBUSY here since we
don't want to re-initialize the device when one or more queues has been already
attached. Add a comment and correct the return value to zero.
Reported-by: Jerry Chu <hkchu@google.com>
Cc: Jerry Chu <hkchu@google.com>
Cc: Wei Yongjun <weiyj.lk@gmail.com>
Cc: Eric Dumazet <edumazet@google.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Acked-by: Jerry Chu <hkchu@google.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/tun.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 729ed533bb33..0c9df2fe8f05 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -1593,8 +1593,12 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) | |||
1593 | return err; | 1593 | return err; |
1594 | 1594 | ||
1595 | if (tun->flags & TUN_TAP_MQ && | 1595 | if (tun->flags & TUN_TAP_MQ && |
1596 | (tun->numqueues + tun->numdisabled > 1)) | 1596 | (tun->numqueues + tun->numdisabled > 1)) { |
1597 | return -EBUSY; | 1597 | /* One or more queue has already been attached, no need |
1598 | * to initialize the device again. | ||
1599 | */ | ||
1600 | return 0; | ||
1601 | } | ||
1598 | } | 1602 | } |
1599 | else { | 1603 | else { |
1600 | char *name; | 1604 | char *name; |