<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/net/tipc, branch v4.5</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v4.5</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v4.5'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2016-03-07T04:00:08Z</updated>
<entry>
<title>tipc: fix nullptr crash during subscription cancel</title>
<updated>2016-03-07T04:00:08Z</updated>
<author>
<name>Parthasarathy Bhuvaragan</name>
<email>parthasarathy.bhuvaragan@ericsson.com</email>
</author>
<published>2016-03-03T16:54:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=4de13d7ed6ffdcbb34317acaa9236f121176f5f8'/>
<id>urn:sha1:4de13d7ed6ffdcbb34317acaa9236f121176f5f8</id>
<content type='text'>
commit 4d5cfcba2f6e ('tipc: fix connection abort during subscription
cancel'), removes the check for a valid subscription before calling
tipc_nametbl_subscribe().

This will lead to a nullptr exception when we process a
subscription cancel request. For a cancel request, a null
subscription is passed to tipc_nametbl_subscribe() resulting
in exception.

In this commit, we call tipc_nametbl_subscribe() only for
a valid subscription.

Fixes: 4d5cfcba2f6e ('tipc: fix connection abort during subscription cancel')
Reported-by: Anders Widell &lt;anders.widell@ericsson.com&gt;
Signed-off-by: Parthasarathy Bhuvaragan &lt;parthasarathy.bhuvaragan@ericsson.com&gt;
Acked-by: Jon Maloy &lt;jon.maloy@ericsson.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>tipc: Revert "tipc: use existing sk_write_queue for outgoing packet chain"</title>
<updated>2016-03-03T21:30:29Z</updated>
<author>
<name>Parthasarathy Bhuvaragan</name>
<email>parthasarathy.bhuvaragan@ericsson.com</email>
</author>
<published>2016-03-01T10:07:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f214fc402967e1bc94ad7f39faa03db5813d6849'/>
<id>urn:sha1:f214fc402967e1bc94ad7f39faa03db5813d6849</id>
<content type='text'>
reverts commit 94153e36e709e ("tipc: use existing sk_write_queue for
outgoing packet chain")

In Commit 94153e36e709e, we assume that we fill &amp; empty the socket's
sk_write_queue within the same lock_sock() session.

This is not true if the link is congested. During congestion, the
socket lock is released while we wait for the congestion to cease.
This implementation causes a nullptr exception, if the user space
program has several threads accessing the same socket descriptor.

Consider two threads of the same program performing the following:
     Thread1                                  Thread2
--------------------                    ----------------------
Enter tipc_sendmsg()                    Enter tipc_sendmsg()
lock_sock()                             lock_sock()
Enter tipc_link_xmit(), ret=ELINKCONG   spin on socket lock..
sk_wait_event()                             :
release_sock()                          grab socket lock
    :                                   Enter tipc_link_xmit(), ret=0
    :                                   release_sock()
Wakeup after congestion
lock_sock()
skb = skb_peek(pktchain);
!! TIPC_SKB_CB(skb)-&gt;wakeup_pending = tsk-&gt;link_cong;

In this case, the second thread transmits the buffers belonging to
both thread1 and thread2 successfully. When the first thread wakeup
after the congestion it assumes that the pktchain is intact and
operates on the skb's in it, which leads to the following exception:

[2102.439969] BUG: unable to handle kernel NULL pointer dereference at 00000000000000d0
[2102.440074] IP: [&lt;ffffffffa005f330&gt;] __tipc_link_xmit+0x2b0/0x4d0 [tipc]
[2102.440074] PGD 3fa3f067 PUD 3fa6b067 PMD 0
[2102.440074] Oops: 0000 [#1] SMP
[2102.440074] CPU: 2 PID: 244 Comm: sender Not tainted 3.12.28 #1
[2102.440074] RIP: 0010:[&lt;ffffffffa005f330&gt;]  [&lt;ffffffffa005f330&gt;] __tipc_link_xmit+0x2b0/0x4d0 [tipc]
[...]
[2102.440074] Call Trace:
[2102.440074]  [&lt;ffffffff8163f0b9&gt;] ? schedule+0x29/0x70
[2102.440074]  [&lt;ffffffffa006a756&gt;] ? tipc_node_unlock+0x46/0x170 [tipc]
[2102.440074]  [&lt;ffffffffa005f761&gt;] tipc_link_xmit+0x51/0xf0 [tipc]
[2102.440074]  [&lt;ffffffffa006d8ae&gt;] tipc_send_stream+0x11e/0x4f0 [tipc]
[2102.440074]  [&lt;ffffffff8106b150&gt;] ? __wake_up_sync+0x20/0x20
[2102.440074]  [&lt;ffffffffa006dc9c&gt;] tipc_send_packet+0x1c/0x20 [tipc]
[2102.440074]  [&lt;ffffffff81502478&gt;] sock_sendmsg+0xa8/0xd0
[2102.440074]  [&lt;ffffffff81507895&gt;] ? release_sock+0x145/0x170
[2102.440074]  [&lt;ffffffff815030d8&gt;] ___sys_sendmsg+0x3d8/0x3e0
[2102.440074]  [&lt;ffffffff816426ae&gt;] ? _raw_spin_unlock+0xe/0x10
[2102.440074]  [&lt;ffffffff81115c2a&gt;] ? handle_mm_fault+0x6ca/0x9d0
[2102.440074]  [&lt;ffffffff8107dd65&gt;] ? set_next_entity+0x85/0xa0
[2102.440074]  [&lt;ffffffff816426de&gt;] ? _raw_spin_unlock_irq+0xe/0x20
[2102.440074]  [&lt;ffffffff8107463c&gt;] ? finish_task_switch+0x5c/0xc0
[2102.440074]  [&lt;ffffffff8163ea8c&gt;] ? __schedule+0x34c/0x950
[2102.440074]  [&lt;ffffffff81504e12&gt;] __sys_sendmsg+0x42/0x80
[2102.440074]  [&lt;ffffffff81504e62&gt;] SyS_sendmsg+0x12/0x20
[2102.440074]  [&lt;ffffffff8164aed2&gt;] system_call_fastpath+0x16/0x1b

In this commit, we maintain the skb list always in the stack.

Signed-off-by: Parthasarathy Bhuvaragan &lt;parthasarathy.bhuvaragan@ericsson.com&gt;
Acked-by: Ying Xue &lt;ying.xue@windriver.com&gt;
Acked-by: Jon Maloy &lt;jon.maloy@ericsson.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>tipc: unlock in error path</title>
<updated>2016-02-19T20:38:44Z</updated>
<author>
<name>Insu Yun</name>
<email>wuninsu@gmail.com</email>
</author>
<published>2016-02-17T16:47:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b53ce3e7d407aa4196877a48b8601181162ab158'/>
<id>urn:sha1:b53ce3e7d407aa4196877a48b8601181162ab158</id>
<content type='text'>
tipc_bcast_unlock need to be unlocked in error path.

Signed-off-by: Insu Yun &lt;wuninsu@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>tipc: fix premature addition of node to lookup table</title>
<updated>2016-02-16T20:57:11Z</updated>
<author>
<name>Jon Paul Maloy</name>
<email>jon.maloy@ericsson.com</email>
</author>
<published>2016-02-10T21:14:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d5c91fb72f1652ea3026925240a0998a42ddb16b'/>
<id>urn:sha1:d5c91fb72f1652ea3026925240a0998a42ddb16b</id>
<content type='text'>
In commit 5266698661401a ("tipc: let broadcast packet reception
use new link receive function") we introduced a new per-node
broadcast reception link instance. This link is created at the
moment the node itself is created. Unfortunately, the allocation
is done after the node instance has already been added to the node
lookup hash table. This creates a potential race condition, where
arriving broadcast packets are able to find and access the node
before it has been fully initialized, and before the above mentioned
link has been created. The result is occasional crashes in the function
tipc_bcast_rcv(), which is trying to access the not-yet existing link.

We fix this by deferring the addition of the node instance until after
it has been fully initialized in the function tipc_node_create().

Acked-by: Ying Xue &lt;ying.xue@windriver.com&gt;
Signed-off-by: Jon Maloy &lt;jon.maloy@ericsson.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>tipc: fix connection abort during subscription cancel</title>
<updated>2016-01-29T20:14:21Z</updated>
<author>
<name>Parthasarathy Bhuvaragan</name>
<email>parthasarathy.bhuvaragan@ericsson.com</email>
</author>
<published>2016-01-27T10:35:59Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=4d5cfcba2f6ec494d8810b9e3c0a7b06255c8067'/>
<id>urn:sha1:4d5cfcba2f6ec494d8810b9e3c0a7b06255c8067</id>
<content type='text'>
In 'commit 7fe8097cef5f ("tipc: fix nullpointer bug when subscribing
to events")', we terminate the connection if the subscription
creation fails.
In the same commit, the subscription creation result was based on
the value of the subscription pointer (set in the function) instead
of the return code.

Unfortunately, the same function tipc_subscrp_create() handles
subscription cancel request. For a subscription cancellation request,
the subscription pointer cannot be set. Thus if a subscriber has
several subscriptions and cancels any of them, the connection is
terminated.

In this commit, we terminate the connection based on the return value
of tipc_subscrp_create().
Fixes: commit 7fe8097cef5f ("tipc: fix nullpointer bug when subscribing to events")

Reviewed-by:  Jon Maloy &lt;jon.maloy@ericsson.com&gt;
Signed-off-by: Parthasarathy Bhuvaragan &lt;parthasarathy.bhuvaragan@ericsson.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>ip_tunnel: Move stats update to iptunnel_xmit()</title>
<updated>2015-12-26T04:32:23Z</updated>
<author>
<name>Pravin B Shelar</name>
<email>pshelar@nicira.com</email>
</author>
<published>2015-12-24T22:34:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=039f50629b7f860f36644ed1f34b27da9aa62f43'/>
<id>urn:sha1:039f50629b7f860f36644ed1f34b27da9aa62f43</id>
<content type='text'>
By moving stats update into iptunnel_xmit(), we can simplify
iptunnel_xmit() usage. With this change there is no need to
call another function (iptunnel_xmit_stats()) to update stats
in tunnel xmit code path.

Signed-off-by: Pravin B Shelar &lt;pshelar@nicira.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>2015-12-04T02:09:12Z</updated>
<author>
<name>David S. Miller</name>
<email>davem@davemloft.net</email>
</author>
<published>2015-12-04T02:03:21Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f188b951f33a0464338f94f928338f84fc0e4392'/>
<id>urn:sha1:f188b951f33a0464338f94f928338f84fc0e4392</id>
<content type='text'>
Conflicts:
	drivers/net/ethernet/renesas/ravb_main.c
	kernel/bpf/syscall.c
	net/ipv4/ipmr.c

All three conflicts were cases of overlapping changes.

Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>tipc: fix node reference count bug</title>
<updated>2015-12-03T20:19:40Z</updated>
<author>
<name>Jon Paul Maloy</name>
<email>jon.maloy@ericsson.com</email>
</author>
<published>2015-12-02T20:19:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=dc8d1eb305984b1182f5e85de3c3a1f8592b83af'/>
<id>urn:sha1:dc8d1eb305984b1182f5e85de3c3a1f8592b83af</id>
<content type='text'>
Commit 5405ff6e15f40f2f ("tipc: convert node lock to rwlock")
introduced a bug to the node reference counter handling. When a
message is successfully sent in the function tipc_node_xmit(),
we return directly after releasing the node lock, instead of
continuing and decrementing the node reference counter as we
should do.

This commit fixes this bug.

Signed-off-by: Jon Maloy &lt;jon.maloy@ericsson.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: Generalise wq_has_sleeper helper</title>
<updated>2015-11-30T19:47:33Z</updated>
<author>
<name>Herbert Xu</name>
<email>herbert@gondor.apana.org.au</email>
</author>
<published>2015-11-26T05:55:39Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=1ce0bf50ae2233c7115a18c0c623662d177b434c'/>
<id>urn:sha1:1ce0bf50ae2233c7115a18c0c623662d177b434c</id>
<content type='text'>
The memory barrier in the helper wq_has_sleeper is needed by just
about every user of waitqueue_active.  This patch generalises it
by making it take a wait_queue_head_t directly.  The existing
helper is renamed to skwq_has_sleeper.

Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>tipc: fix error handling of expanding buffer headroom</title>
<updated>2015-11-24T16:26:19Z</updated>
<author>
<name>Ying Xue</name>
<email>ying.xue@windriver.com</email>
</author>
<published>2015-11-24T05:57:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7098356baca723513e97ca0020df4e18bc353be3'/>
<id>urn:sha1:7098356baca723513e97ca0020df4e18bc353be3</id>
<content type='text'>
Coverity says:

*** CID 1338065:  Error handling issues  (CHECKED_RETURN)
/net/tipc/udp_media.c: 162 in tipc_udp_send_msg()
156     	struct udp_media_addr *dst = (struct udp_media_addr *)&amp;dest-&gt;value;
157     	struct udp_media_addr *src = (struct udp_media_addr *)&amp;b-&gt;addr.value;
158     	struct sk_buff *clone;
159     	struct rtable *rt;
160
161     	if (skb_headroom(skb) &lt; UDP_MIN_HEADROOM)
&gt;&gt;&gt;     CID 1338065:  Error handling issues  (CHECKED_RETURN)
&gt;&gt;&gt;     Calling "pskb_expand_head" without checking return value (as is done elsewhere 51 out of 56 times).
162     		pskb_expand_head(skb, UDP_MIN_HEADROOM, 0, GFP_ATOMIC);
163
164     	clone = skb_clone(skb, GFP_ATOMIC);
165     	skb_set_inner_protocol(clone, htons(ETH_P_TIPC));
166     	ub = rcu_dereference_rtnl(b-&gt;media_ptr);
167     	if (!ub) {

When expanding buffer headroom over udp tunnel with pskb_expand_head(),
it's unfortunate that we don't check its return value. As a result, if
the function returns an error code due to the lack of memory, it may
cause unpredictable consequence as we unconditionally consider that
it's always successful.

Fixes: e53567948f82 ("tipc: conditionally expand buffer headroom over udp tunnel")
Reported-by: &lt;scan-admin@coverity.com&gt;
Cc: Stephen Hemminger &lt;stephen@networkplumber.org&gt;
Signed-off-by: Ying Xue &lt;ying.xue@windriver.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
</feed>
