netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tun: avoid owner checks on IFF_ATTACH_QUEUE
@ 2013-01-10 11:31 Michael S. Tsirkin
  2013-01-10 11:55 ` Stefan Hajnoczi
  2013-01-10 14:08 ` Jason Wang
  0 siblings, 2 replies; 10+ messages in thread
From: Michael S. Tsirkin @ 2013-01-10 11:31 UTC (permalink / raw)
  To: Jason Wang; +Cc: Stefan Hajnoczi, David S. Miller, netdev, linux-kernel

At the moment, we check owner when we enable queue in tun.
This seems redundant and will break some valid uses
where fd is passed around: I think TUNSETOWNER is there
to prevent others from attaching to a persistent device not
owned by them. Here the fd is already attached,
enabling/disabling queue is more like read/write.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

---

Note: this is unrelated to Stefan's bugfix.

diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index fbd106e..78e3225 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -1789,10 +1792,8 @@ static int tun_set_queue(struct file *file, struct ifreq *ifr)
 		tun = tfile->detached;
 		if (!tun)
 			ret = -EINVAL;
-		else if (tun_not_capable(tun))
-			ret = -EPERM;
 		else
 			ret = tun_attach(tun, file);
 	} else if (ifr->ifr_flags & IFF_DETACH_QUEUE) {
 		tun = rcu_dereference_protected(tfile->tun,
 						lockdep_rtnl_is_held());
-- 
MST

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2013-01-10 22:38 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-10 11:31 [PATCH] tun: avoid owner checks on IFF_ATTACH_QUEUE Michael S. Tsirkin
2013-01-10 11:55 ` Stefan Hajnoczi
2013-01-10 22:38   ` David Miller
2013-01-10 14:08 ` Jason Wang
2013-01-10 14:19   ` Michael S. Tsirkin
2013-01-10 14:27     ` Jason Wang
2013-01-10 14:41       ` Michael S. Tsirkin
2013-01-10 14:47         ` Jason Wang
2013-01-10 15:10           ` Michael S. Tsirkin
2013-01-10 15:27             ` Jason Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).