<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/drivers/net/tun.c, branch linux-5.1.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.</subtitle>
<id>https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-5.1.y</id>
<link rel='self' href='https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-5.1.y'/>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/'/>
<updated>2019-07-03T11:13:42Z</updated>
<entry>
<title>tun: wake up waitqueues after IFF_UP is set</title>
<updated>2019-07-03T11:13:42Z</updated>
<author>
<name>Fei Li</name>
<email>lifei.shirley@bytedance.com</email>
</author>
<published>2019-06-17T13:26:36Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=9590d1d1b033cb3c1211a90c66b928a141d6b129'/>
<id>urn:sha1:9590d1d1b033cb3c1211a90c66b928a141d6b129</id>
<content type='text'>
[ Upstream commit 72b319dc08b4924a29f5e2560ef6d966fa54c429 ]

Currently after setting tap0 link up, the tun code wakes tx/rx waited
queues up in tun_net_open() when .ndo_open() is called, however the
IFF_UP flag has not been set yet. If there's already a wait queue, it
would fail to transmit when checking the IFF_UP flag in tun_sendmsg().
Then the saving vhost_poll_start() will add the wq into wqh until it
is waken up again. Although this works when IFF_UP flag has been set
when tun_chr_poll detects; this is not true if IFF_UP flag has not
been set at that time. Sadly the latter case is a fatal error, as
the wq will never be waken up in future unless later manually
setting link up on purpose.

Fix this by moving the wakeup process into the NETDEV_UP event
notifying process, this makes sure IFF_UP has been set before all
waited queues been waken up.

Signed-off-by: Fei Li &lt;lifei.shirley@bytedance.com&gt;
Acked-by: Jason Wang &lt;jasowang@redhat.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>tuntap: synchronize through tfiles array instead of tun-&gt;numqueues</title>
<updated>2019-05-16T17:35:38Z</updated>
<author>
<name>Jason Wang</name>
<email>jasowang@redhat.com</email>
</author>
<published>2019-05-09T03:20:18Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=0f852d10a0bf4ac9fa34ce3b4d2f84d321d1249b'/>
<id>urn:sha1:0f852d10a0bf4ac9fa34ce3b4d2f84d321d1249b</id>
<content type='text'>
[ Upstream commit 9871a9e47a2646fe30ae7fd2e67668a8d30912f6 ]

When a queue(tfile) is detached through __tun_detach(), we move the
last enabled tfile to the position where detached one sit but don't
NULL out last position. We expect to synchronize the datapath through
tun-&gt;numqueues. Unfortunately, this won't work since we're lacking
sufficient mechanism to order or synchronize the access to
tun-&gt;numqueues.

To fix this, NULL out the last position during detaching and check
RCU protected tfile against NULL instead of checking tun-&gt;numqueues in
datapath.

Cc: YueHaibing &lt;yuehaibing@huawei.com&gt;
Cc: Cong Wang &lt;xiyou.wangcong@gmail.com&gt;
Cc: weiyongjun (A) &lt;weiyongjun1@huawei.com&gt;
Cc: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Fixes: c8d68e6be1c3b ("tuntap: multiqueue support")
Signed-off-by: Jason Wang &lt;jasowang@redhat.com&gt;
Reviewed-by: Wei Yongjun &lt;weiyongjun1@huawei.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>tuntap: fix dividing by zero in ebpf queue selection</title>
<updated>2019-05-16T17:35:37Z</updated>
<author>
<name>Jason Wang</name>
<email>jasowang@redhat.com</email>
</author>
<published>2019-05-09T03:20:17Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=6e1d1a3a3348c69dddd5b56a714c0703f0ca7213'/>
<id>urn:sha1:6e1d1a3a3348c69dddd5b56a714c0703f0ca7213</id>
<content type='text'>
[ Upstream commit a35d310f03a692bf4798eb309a1950a06a150620 ]

We need check if tun-&gt;numqueues is zero (e.g for the persist device)
before trying to use it for modular arithmetic.

Reported-by: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Fixes: 96f84061620c6("tun: add eBPF based queue selection method")
Signed-off-by: Jason Wang &lt;jasowang@redhat.com&gt;
Reviewed-by: Eric Dumazet &lt;edumazet@google.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>tun: add a missing rcu_read_unlock() in error path</title>
<updated>2019-03-16T20:16:37Z</updated>
<author>
<name>Eric Dumazet</name>
<email>edumazet@google.com</email>
</author>
<published>2019-03-16T20:09:53Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=9180bb4f046064dfa4541488102703b402bb04e1'/>
<id>urn:sha1:9180bb4f046064dfa4541488102703b402bb04e1</id>
<content type='text'>
In my latest patch I missed one rcu_read_unlock(), in case
device is down.

Fixes: 4477138fa0ae ("tun: properly test for IFF_UP")
Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Reported-by: syzbot &lt;syzkaller@googlegroups.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>tun: properly test for IFF_UP</title>
<updated>2019-03-15T22:42:11Z</updated>
<author>
<name>Eric Dumazet</name>
<email>edumazet@google.com</email>
</author>
<published>2019-03-15T03:19:47Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=4477138fa0ae4e1b699786ef0600863ea6e6c61c'/>
<id>urn:sha1:4477138fa0ae4e1b699786ef0600863ea6e6c61c</id>
<content type='text'>
Same reasons than the ones explained in commit 4179cb5a4c92
("vxlan: test dev-&gt;flags &amp; IFF_UP before calling netif_rx()")

netif_rx_ni() or napi_gro_frags() must be called under a strict contract.

At device dismantle phase, core networking clears IFF_UP
and flush_all_backlogs() is called after rcu grace period
to make sure no incoming packet might be in a cpu backlog
and still referencing the device.

A similar protocol is used for gro layer.

Most drivers call netif_rx() from their interrupt handler,
and since the interrupts are disabled at device dismantle,
netif_rx() does not have to check dev-&gt;flags &amp; IFF_UP

Virtual drivers do not have this guarantee, and must
therefore make the check themselves.

Fixes: 1bd4978a88ac ("tun: honor IFF_UP in tun_get_user()")
Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Reported-by: syzbot &lt;syzkaller@googlegroups.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net</title>
<updated>2019-03-02T20:54:35Z</updated>
<author>
<name>David S. Miller</name>
<email>davem@davemloft.net</email>
</author>
<published>2019-03-02T20:54:35Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=9eb359140cd307f8a14f61c19b155ffca5291057'/>
<id>urn:sha1:9eb359140cd307f8a14f61c19b155ffca5291057</id>
<content type='text'>
</content>
</entry>
<entry>
<title>tun: remove unnecessary memory barrier</title>
<updated>2019-02-25T22:27:21Z</updated>
<author>
<name>Timur Celik</name>
<email>mail@timurcelik.de</email>
</author>
<published>2019-02-25T20:13:13Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=ecef67cb10db7b83b3b71c61dbb29aa070ab0112'/>
<id>urn:sha1:ecef67cb10db7b83b3b71c61dbb29aa070ab0112</id>
<content type='text'>
Replace set_current_state with __set_current_state since no memory
barrier is needed at this point.

Signed-off-by: Timur Celik &lt;mail@timurcelik.de&gt;
Reviewed-by: Eric Dumazet &lt;edumazet@google.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>tun: fix blocking read</title>
<updated>2019-02-25T06:11:53Z</updated>
<author>
<name>Timur Celik</name>
<email>mail@timurcelik.de</email>
</author>
<published>2019-02-23T11:53:13Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=71828b2240692cec0e68b8d867bc00e1745e7fae'/>
<id>urn:sha1:71828b2240692cec0e68b8d867bc00e1745e7fae</id>
<content type='text'>
This patch moves setting of the current state into the loop. Otherwise
the task may end up in a busy wait loop if none of the break conditions
are met.

Signed-off-by: Timur Celik &lt;mail@timurcelik.de&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: Don't set transport offset to invalid value</title>
<updated>2019-02-22T20:55:31Z</updated>
<author>
<name>Maxim Mikityanskiy</name>
<email>maximmi@mellanox.com</email>
</author>
<published>2019-02-21T12:39:57Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=d2aa125d629080c4f3e31f23b7f612ef6b8492ac'/>
<id>urn:sha1:d2aa125d629080c4f3e31f23b7f612ef6b8492ac</id>
<content type='text'>
If the socket was created with socket(AF_PACKET, SOCK_RAW, 0),
skb-&gt;protocol will be unset, __skb_flow_dissect() will fail, and
skb_probe_transport_header() will fall back to the offset_hint, making
the resulting skb_transport_offset incorrect.

If, however, there is no transport header in the packet,
transport_header shouldn't be set to an arbitrary value.

Fix it by leaving the transport offset unset if it couldn't be found, to
be explicit rather than to fill it with some wrong value. It changes the
behavior, but if some code relied on the old behavior, it would be
broken anyway, as the old one is incorrect.

Signed-off-by: Maxim Mikityanskiy &lt;maximmi@mellanox.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>tun: move the call to tun_set_real_num_queues</title>
<updated>2019-01-31T05:40:25Z</updated>
<author>
<name>George Amanakis</name>
<email>gamanakis@gmail.com</email>
</author>
<published>2019-01-30T03:50:13Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=3a03cb8456cc1d61c467a5375e0a10e5207b948c'/>
<id>urn:sha1:3a03cb8456cc1d61c467a5375e0a10e5207b948c</id>
<content type='text'>
Call tun_set_real_num_queues() after the increment of tun-&gt;numqueues
since the former depends on it. Otherwise, the number of queues is not
correctly accounted for, which results to warnings similar to:
"vnet0 selects TX queue 11, but real number of TX queues is 11".

Fixes: 0b7959b62573 ("tun: publish tfile after it's fully initialized")
Reported-and-tested-by: George Amanakis &lt;gamanakis@gmail.com&gt;
Signed-off-by: George Amanakis &lt;gamanakis@gmail.com&gt;
Signed-off-by: Stanislav Fomichev &lt;sdf@google.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
</feed>
