<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-stable.git/net/rxrpc/input.c, branch v4.8</title>
<subtitle>Linux kernel stable tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/'/>
<entry>
<title>rxrpc: Free packets discarded in data_ready</title>
<updated>2016-08-09T16:13:56+00:00</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2016-08-09T15:58:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=992c273af9d9f12a2e470731f69bb3baa694562b'/>
<id>992c273af9d9f12a2e470731f69bb3baa694562b</id>
<content type='text'>
Under certain conditions, the data_ready handler will discard a packet.
These need to be freed.

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Under certain conditions, the data_ready handler will discard a packet.
These need to be freed.

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rxrpc: Fix a use-after-push in data_ready handler</title>
<updated>2016-08-09T16:13:55+00:00</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2016-08-09T10:30:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=50fd85a1f94753b86a7f540794dfd4f799e81ac2'/>
<id>50fd85a1f94753b86a7f540794dfd4f799e81ac2</id>
<content type='text'>
Fix a use of a packet after it has been enqueued onto the packet processing
queue in the data_ready handler.  Once on a call's Rx queue, we mustn't
touch it any more as it may be dequeued and freed by the call processor
running on a work queue.

Save the values we need before enqueuing.

Without this, we can get an oops like the following:

BUG: unable to handle kernel NULL pointer dereference at 000000000000009c
IP: [&lt;ffffffffa01854e8&gt;] rxrpc_fast_process_packet+0x724/0xa11 [af_rxrpc]
PGD 0 
Oops: 0000 [#1] SMP
Modules linked in: kafs(E) af_rxrpc(E) [last unloaded: af_rxrpc]
CPU: 2 PID: 0 Comm: swapper/2 Tainted: G            E   4.7.0-fsdevel+ #1336
Hardware name: ASUS All Series/H97-PLUS, BIOS 2306 10/09/2014
task: ffff88040d6863c0 task.stack: ffff88040d68c000
RIP: 0010:[&lt;ffffffffa01854e8&gt;]  [&lt;ffffffffa01854e8&gt;] rxrpc_fast_process_packet+0x724/0xa11 [af_rxrpc]
RSP: 0018:ffff88041fb03a78  EFLAGS: 00010246
RAX: ffffffffffffffff RBX: ffff8803ff195b00 RCX: 0000000000000001
RDX: ffffffffa01854d1 RSI: 0000000000000008 RDI: ffff8803ff195b00
RBP: ffff88041fb03ab0 R08: 0000000000000000 R09: 0000000000000001
R10: ffff88041fb038c8 R11: 0000000000000000 R12: ffff880406874800
R13: 0000000000000001 R14: 0000000000000000 R15: 0000000000000000
FS:  0000000000000000(0000) GS:ffff88041fb00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000000000000009c CR3: 0000000001c14000 CR4: 00000000001406e0
Stack:
 ffff8803ff195ea0 ffff880408348800 ffff880406874800 ffff8803ff195b00
 ffff880408348800 ffff8803ff195ed8 0000000000000000 ffff88041fb03af0
 ffffffffa0186072 0000000000000000 ffff8804054da000 0000000000000000
Call Trace:
 &lt;IRQ&gt; 
 [&lt;ffffffffa0186072&gt;] rxrpc_data_ready+0x89d/0xbae [af_rxrpc]
 [&lt;ffffffff814c94d7&gt;] __sock_queue_rcv_skb+0x24c/0x2b2
 [&lt;ffffffff8155c59a&gt;] __udp_queue_rcv_skb+0x4b/0x1bd
 [&lt;ffffffff8155e048&gt;] udp_queue_rcv_skb+0x281/0x4db
 [&lt;ffffffff8155ea8f&gt;] __udp4_lib_rcv+0x7ed/0x963
 [&lt;ffffffff8155ef9a&gt;] udp_rcv+0x15/0x17
 [&lt;ffffffff81531d86&gt;] ip_local_deliver_finish+0x1c3/0x318
 [&lt;ffffffff81532544&gt;] ip_local_deliver+0xbb/0xc4
 [&lt;ffffffff81531bc3&gt;] ? inet_del_offload+0x40/0x40
 [&lt;ffffffff815322a9&gt;] ip_rcv_finish+0x3ce/0x42c
 [&lt;ffffffff81532851&gt;] ip_rcv+0x304/0x33d
 [&lt;ffffffff81531edb&gt;] ? ip_local_deliver_finish+0x318/0x318
 [&lt;ffffffff814dff9d&gt;] __netif_receive_skb_core+0x601/0x6e8
 [&lt;ffffffff814e072e&gt;] __netif_receive_skb+0x13/0x54
 [&lt;ffffffff814e082a&gt;] netif_receive_skb_internal+0xbb/0x17c
 [&lt;ffffffff814e1838&gt;] napi_gro_receive+0xf9/0x1bd
 [&lt;ffffffff8144eb9f&gt;] rtl8169_poll+0x32b/0x4a8
 [&lt;ffffffff814e1c7b&gt;] net_rx_action+0xe8/0x357
 [&lt;ffffffff81051074&gt;] __do_softirq+0x1aa/0x414
 [&lt;ffffffff810514ab&gt;] irq_exit+0x3d/0xb0
 [&lt;ffffffff810184a2&gt;] do_IRQ+0xe4/0xfc
 [&lt;ffffffff81612053&gt;] common_interrupt+0x93/0x93
 &lt;EOI&gt; 
 [&lt;ffffffff814af837&gt;] ? cpuidle_enter_state+0x1ad/0x2be
 [&lt;ffffffff814af832&gt;] ? cpuidle_enter_state+0x1a8/0x2be
 [&lt;ffffffff814af96a&gt;] cpuidle_enter+0x12/0x14
 [&lt;ffffffff8108956f&gt;] call_cpuidle+0x39/0x3b
 [&lt;ffffffff81089855&gt;] cpu_startup_entry+0x230/0x35d
 [&lt;ffffffff810312ea&gt;] start_secondary+0xf4/0xf7

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fix a use of a packet after it has been enqueued onto the packet processing
queue in the data_ready handler.  Once on a call's Rx queue, we mustn't
touch it any more as it may be dequeued and freed by the call processor
running on a work queue.

Save the values we need before enqueuing.

Without this, we can get an oops like the following:

BUG: unable to handle kernel NULL pointer dereference at 000000000000009c
IP: [&lt;ffffffffa01854e8&gt;] rxrpc_fast_process_packet+0x724/0xa11 [af_rxrpc]
PGD 0 
Oops: 0000 [#1] SMP
Modules linked in: kafs(E) af_rxrpc(E) [last unloaded: af_rxrpc]
CPU: 2 PID: 0 Comm: swapper/2 Tainted: G            E   4.7.0-fsdevel+ #1336
Hardware name: ASUS All Series/H97-PLUS, BIOS 2306 10/09/2014
task: ffff88040d6863c0 task.stack: ffff88040d68c000
RIP: 0010:[&lt;ffffffffa01854e8&gt;]  [&lt;ffffffffa01854e8&gt;] rxrpc_fast_process_packet+0x724/0xa11 [af_rxrpc]
RSP: 0018:ffff88041fb03a78  EFLAGS: 00010246
RAX: ffffffffffffffff RBX: ffff8803ff195b00 RCX: 0000000000000001
RDX: ffffffffa01854d1 RSI: 0000000000000008 RDI: ffff8803ff195b00
RBP: ffff88041fb03ab0 R08: 0000000000000000 R09: 0000000000000001
R10: ffff88041fb038c8 R11: 0000000000000000 R12: ffff880406874800
R13: 0000000000000001 R14: 0000000000000000 R15: 0000000000000000
FS:  0000000000000000(0000) GS:ffff88041fb00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000000000000009c CR3: 0000000001c14000 CR4: 00000000001406e0
Stack:
 ffff8803ff195ea0 ffff880408348800 ffff880406874800 ffff8803ff195b00
 ffff880408348800 ffff8803ff195ed8 0000000000000000 ffff88041fb03af0
 ffffffffa0186072 0000000000000000 ffff8804054da000 0000000000000000
Call Trace:
 &lt;IRQ&gt; 
 [&lt;ffffffffa0186072&gt;] rxrpc_data_ready+0x89d/0xbae [af_rxrpc]
 [&lt;ffffffff814c94d7&gt;] __sock_queue_rcv_skb+0x24c/0x2b2
 [&lt;ffffffff8155c59a&gt;] __udp_queue_rcv_skb+0x4b/0x1bd
 [&lt;ffffffff8155e048&gt;] udp_queue_rcv_skb+0x281/0x4db
 [&lt;ffffffff8155ea8f&gt;] __udp4_lib_rcv+0x7ed/0x963
 [&lt;ffffffff8155ef9a&gt;] udp_rcv+0x15/0x17
 [&lt;ffffffff81531d86&gt;] ip_local_deliver_finish+0x1c3/0x318
 [&lt;ffffffff81532544&gt;] ip_local_deliver+0xbb/0xc4
 [&lt;ffffffff81531bc3&gt;] ? inet_del_offload+0x40/0x40
 [&lt;ffffffff815322a9&gt;] ip_rcv_finish+0x3ce/0x42c
 [&lt;ffffffff81532851&gt;] ip_rcv+0x304/0x33d
 [&lt;ffffffff81531edb&gt;] ? ip_local_deliver_finish+0x318/0x318
 [&lt;ffffffff814dff9d&gt;] __netif_receive_skb_core+0x601/0x6e8
 [&lt;ffffffff814e072e&gt;] __netif_receive_skb+0x13/0x54
 [&lt;ffffffff814e082a&gt;] netif_receive_skb_internal+0xbb/0x17c
 [&lt;ffffffff814e1838&gt;] napi_gro_receive+0xf9/0x1bd
 [&lt;ffffffff8144eb9f&gt;] rtl8169_poll+0x32b/0x4a8
 [&lt;ffffffff814e1c7b&gt;] net_rx_action+0xe8/0x357
 [&lt;ffffffff81051074&gt;] __do_softirq+0x1aa/0x414
 [&lt;ffffffff810514ab&gt;] irq_exit+0x3d/0xb0
 [&lt;ffffffff810184a2&gt;] do_IRQ+0xe4/0xfc
 [&lt;ffffffff81612053&gt;] common_interrupt+0x93/0x93
 &lt;EOI&gt; 
 [&lt;ffffffff814af837&gt;] ? cpuidle_enter_state+0x1ad/0x2be
 [&lt;ffffffff814af832&gt;] ? cpuidle_enter_state+0x1a8/0x2be
 [&lt;ffffffff814af96a&gt;] cpuidle_enter+0x12/0x14
 [&lt;ffffffff8108956f&gt;] call_cpuidle+0x39/0x3b
 [&lt;ffffffff81089855&gt;] cpu_startup_entry+0x230/0x35d
 [&lt;ffffffff810312ea&gt;] start_secondary+0xf4/0xf7

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rxrpc: Once packet posted in data_ready, don't retry posting</title>
<updated>2016-08-09T16:13:55+00:00</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2016-08-09T09:11:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=2e7e9758b2b680fa615d5cf70b7af416e96162d2'/>
<id>2e7e9758b2b680fa615d5cf70b7af416e96162d2</id>
<content type='text'>
Once a packet has been posted to a connection in the data_ready handler, we
mustn't try reposting if we then find that the connection is dying as the
refcount has been given over to the dying connection and the packet might
no longer exist.

Losing the packet isn't a problem as the peer will retransmit.

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Once a packet has been posted to a connection in the data_ready handler, we
mustn't try reposting if we then find that the connection is dying as the
refcount has been given over to the dying connection and the packet might
no longer exist.

Losing the packet isn't a problem as the peer will retransmit.

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rxrpc: Fix races between skb free, ACK generation and replying</title>
<updated>2016-08-06T04:08:40+00:00</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2016-08-03T13:11:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=372ee16386bbf6dc5eeb0387e1ede963debba82a'/>
<id>372ee16386bbf6dc5eeb0387e1ede963debba82a</id>
<content type='text'>
Inside the kafs filesystem it is possible to occasionally have a call
processed and terminated before we've had a chance to check whether we need
to clean up the rx queue for that call because afs_send_simple_reply() ends
the call when it is done, but this is done in a workqueue item that might
happen to run to completion before afs_deliver_to_call() completes.

Further, it is possible for rxrpc_kernel_send_data() to be called to send a
reply before the last request-phase data skb is released.  The rxrpc skb
destructor is where the ACK processing is done and the call state is
advanced upon release of the last skb.  ACK generation is also deferred to
a work item because it's possible that the skb destructor is not called in
a context where kernel_sendmsg() can be invoked.

To this end, the following changes are made:

 (1) kernel_rxrpc_data_consumed() is added.  This should be called whenever
     an skb is emptied so as to crank the ACK and call states.  This does
     not release the skb, however.  kernel_rxrpc_free_skb() must now be
     called to achieve that.  These together replace
     rxrpc_kernel_data_delivered().

 (2) kernel_rxrpc_data_consumed() is wrapped by afs_data_consumed().

     This makes afs_deliver_to_call() easier to work as the skb can simply
     be discarded unconditionally here without trying to work out what the
     return value of the -&gt;deliver() function means.

     The -&gt;deliver() functions can, via afs_data_complete(),
     afs_transfer_reply() and afs_extract_data() mark that an skb has been
     consumed (thereby cranking the state) without the need to
     conditionally free the skb to make sure the state is correct on an
     incoming call for when the call processor tries to send the reply.

 (3) rxrpc_recvmsg() now has to call kernel_rxrpc_data_consumed() when it
     has finished with a packet and MSG_PEEK isn't set.

 (4) rxrpc_packet_destructor() no longer calls rxrpc_hard_ACK_data().

     Because of this, we no longer need to clear the destructor and put the
     call before we free the skb in cases where we don't want the ACK/call
     state to be cranked.

 (5) The -&gt;deliver() call-type callbacks are made to return -EAGAIN rather
     than 0 if they expect more data (afs_extract_data() returns -EAGAIN to
     the delivery function already), and the caller is now responsible for
     producing an abort if that was the last packet.

 (6) There are many bits of unmarshalling code where:

 		ret = afs_extract_data(call, skb, last, ...);
		switch (ret) {
		case 0:		break;
		case -EAGAIN:	return 0;
		default:	return ret;
		}

     is to be found.  As -EAGAIN can now be passed back to the caller, we
     now just return if ret &lt; 0:

 		ret = afs_extract_data(call, skb, last, ...);
		if (ret &lt; 0)
			return ret;

 (7) Checks for trailing data and empty final data packets has been
     consolidated as afs_data_complete().  So:

		if (skb-&gt;len &gt; 0)
			return -EBADMSG;
		if (!last)
			return 0;

     becomes:

		ret = afs_data_complete(call, skb, last);
		if (ret &lt; 0)
			return ret;

 (8) afs_transfer_reply() now checks the amount of data it has against the
     amount of data desired and the amount of data in the skb and returns
     an error to induce an abort if we don't get exactly what we want.

Without these changes, the following oops can occasionally be observed,
particularly if some printks are inserted into the delivery path:

general protection fault: 0000 [#1] SMP
Modules linked in: kafs(E) af_rxrpc(E) [last unloaded: af_rxrpc]
CPU: 0 PID: 1305 Comm: kworker/u8:3 Tainted: G            E   4.7.0-fsdevel+ #1303
Hardware name: ASUS All Series/H97-PLUS, BIOS 2306 10/09/2014
Workqueue: kafsd afs_async_workfn [kafs]
task: ffff88040be041c0 ti: ffff88040c070000 task.ti: ffff88040c070000
RIP: 0010:[&lt;ffffffff8108fd3c&gt;]  [&lt;ffffffff8108fd3c&gt;] __lock_acquire+0xcf/0x15a1
RSP: 0018:ffff88040c073bc0  EFLAGS: 00010002
RAX: 6b6b6b6b6b6b6b6b RBX: 0000000000000000 RCX: ffff88040d29a710
RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff88040d29a710
RBP: ffff88040c073c70 R08: 0000000000000001 R09: 0000000000000001
R10: 0000000000000001 R11: 0000000000000000 R12: 0000000000000000
R13: 0000000000000000 R14: ffff88040be041c0 R15: ffffffff814c928f
FS:  0000000000000000(0000) GS:ffff88041fa00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fa4595f4750 CR3: 0000000001c14000 CR4: 00000000001406f0
Stack:
 0000000000000006 000000000be04930 0000000000000000 ffff880400000000
 ffff880400000000 ffffffff8108f847 ffff88040be041c0 ffffffff81050446
 ffff8803fc08a920 ffff8803fc08a958 ffff88040be041c0 ffff88040c073c38
Call Trace:
 [&lt;ffffffff8108f847&gt;] ? mark_held_locks+0x5e/0x74
 [&lt;ffffffff81050446&gt;] ? __local_bh_enable_ip+0x9b/0xa1
 [&lt;ffffffff8108f9ca&gt;] ? trace_hardirqs_on_caller+0x16d/0x189
 [&lt;ffffffff810915f4&gt;] lock_acquire+0x122/0x1b6
 [&lt;ffffffff810915f4&gt;] ? lock_acquire+0x122/0x1b6
 [&lt;ffffffff814c928f&gt;] ? skb_dequeue+0x18/0x61
 [&lt;ffffffff81609dbf&gt;] _raw_spin_lock_irqsave+0x35/0x49
 [&lt;ffffffff814c928f&gt;] ? skb_dequeue+0x18/0x61
 [&lt;ffffffff814c928f&gt;] skb_dequeue+0x18/0x61
 [&lt;ffffffffa009aa92&gt;] afs_deliver_to_call+0x344/0x39d [kafs]
 [&lt;ffffffffa009ab37&gt;] afs_process_async_call+0x4c/0xd5 [kafs]
 [&lt;ffffffffa0099e9c&gt;] afs_async_workfn+0xe/0x10 [kafs]
 [&lt;ffffffff81063a3a&gt;] process_one_work+0x29d/0x57c
 [&lt;ffffffff81064ac2&gt;] worker_thread+0x24a/0x385
 [&lt;ffffffff81064878&gt;] ? rescuer_thread+0x2d0/0x2d0
 [&lt;ffffffff810696f5&gt;] kthread+0xf3/0xfb
 [&lt;ffffffff8160a6ff&gt;] ret_from_fork+0x1f/0x40
 [&lt;ffffffff81069602&gt;] ? kthread_create_on_node+0x1cf/0x1cf

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Inside the kafs filesystem it is possible to occasionally have a call
processed and terminated before we've had a chance to check whether we need
to clean up the rx queue for that call because afs_send_simple_reply() ends
the call when it is done, but this is done in a workqueue item that might
happen to run to completion before afs_deliver_to_call() completes.

Further, it is possible for rxrpc_kernel_send_data() to be called to send a
reply before the last request-phase data skb is released.  The rxrpc skb
destructor is where the ACK processing is done and the call state is
advanced upon release of the last skb.  ACK generation is also deferred to
a work item because it's possible that the skb destructor is not called in
a context where kernel_sendmsg() can be invoked.

To this end, the following changes are made:

 (1) kernel_rxrpc_data_consumed() is added.  This should be called whenever
     an skb is emptied so as to crank the ACK and call states.  This does
     not release the skb, however.  kernel_rxrpc_free_skb() must now be
     called to achieve that.  These together replace
     rxrpc_kernel_data_delivered().

 (2) kernel_rxrpc_data_consumed() is wrapped by afs_data_consumed().

     This makes afs_deliver_to_call() easier to work as the skb can simply
     be discarded unconditionally here without trying to work out what the
     return value of the -&gt;deliver() function means.

     The -&gt;deliver() functions can, via afs_data_complete(),
     afs_transfer_reply() and afs_extract_data() mark that an skb has been
     consumed (thereby cranking the state) without the need to
     conditionally free the skb to make sure the state is correct on an
     incoming call for when the call processor tries to send the reply.

 (3) rxrpc_recvmsg() now has to call kernel_rxrpc_data_consumed() when it
     has finished with a packet and MSG_PEEK isn't set.

 (4) rxrpc_packet_destructor() no longer calls rxrpc_hard_ACK_data().

     Because of this, we no longer need to clear the destructor and put the
     call before we free the skb in cases where we don't want the ACK/call
     state to be cranked.

 (5) The -&gt;deliver() call-type callbacks are made to return -EAGAIN rather
     than 0 if they expect more data (afs_extract_data() returns -EAGAIN to
     the delivery function already), and the caller is now responsible for
     producing an abort if that was the last packet.

 (6) There are many bits of unmarshalling code where:

 		ret = afs_extract_data(call, skb, last, ...);
		switch (ret) {
		case 0:		break;
		case -EAGAIN:	return 0;
		default:	return ret;
		}

     is to be found.  As -EAGAIN can now be passed back to the caller, we
     now just return if ret &lt; 0:

 		ret = afs_extract_data(call, skb, last, ...);
		if (ret &lt; 0)
			return ret;

 (7) Checks for trailing data and empty final data packets has been
     consolidated as afs_data_complete().  So:

		if (skb-&gt;len &gt; 0)
			return -EBADMSG;
		if (!last)
			return 0;

     becomes:

		ret = afs_data_complete(call, skb, last);
		if (ret &lt; 0)
			return ret;

 (8) afs_transfer_reply() now checks the amount of data it has against the
     amount of data desired and the amount of data in the skb and returns
     an error to induce an abort if we don't get exactly what we want.

Without these changes, the following oops can occasionally be observed,
particularly if some printks are inserted into the delivery path:

general protection fault: 0000 [#1] SMP
Modules linked in: kafs(E) af_rxrpc(E) [last unloaded: af_rxrpc]
CPU: 0 PID: 1305 Comm: kworker/u8:3 Tainted: G            E   4.7.0-fsdevel+ #1303
Hardware name: ASUS All Series/H97-PLUS, BIOS 2306 10/09/2014
Workqueue: kafsd afs_async_workfn [kafs]
task: ffff88040be041c0 ti: ffff88040c070000 task.ti: ffff88040c070000
RIP: 0010:[&lt;ffffffff8108fd3c&gt;]  [&lt;ffffffff8108fd3c&gt;] __lock_acquire+0xcf/0x15a1
RSP: 0018:ffff88040c073bc0  EFLAGS: 00010002
RAX: 6b6b6b6b6b6b6b6b RBX: 0000000000000000 RCX: ffff88040d29a710
RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff88040d29a710
RBP: ffff88040c073c70 R08: 0000000000000001 R09: 0000000000000001
R10: 0000000000000001 R11: 0000000000000000 R12: 0000000000000000
R13: 0000000000000000 R14: ffff88040be041c0 R15: ffffffff814c928f
FS:  0000000000000000(0000) GS:ffff88041fa00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fa4595f4750 CR3: 0000000001c14000 CR4: 00000000001406f0
Stack:
 0000000000000006 000000000be04930 0000000000000000 ffff880400000000
 ffff880400000000 ffffffff8108f847 ffff88040be041c0 ffffffff81050446
 ffff8803fc08a920 ffff8803fc08a958 ffff88040be041c0 ffff88040c073c38
Call Trace:
 [&lt;ffffffff8108f847&gt;] ? mark_held_locks+0x5e/0x74
 [&lt;ffffffff81050446&gt;] ? __local_bh_enable_ip+0x9b/0xa1
 [&lt;ffffffff8108f9ca&gt;] ? trace_hardirqs_on_caller+0x16d/0x189
 [&lt;ffffffff810915f4&gt;] lock_acquire+0x122/0x1b6
 [&lt;ffffffff810915f4&gt;] ? lock_acquire+0x122/0x1b6
 [&lt;ffffffff814c928f&gt;] ? skb_dequeue+0x18/0x61
 [&lt;ffffffff81609dbf&gt;] _raw_spin_lock_irqsave+0x35/0x49
 [&lt;ffffffff814c928f&gt;] ? skb_dequeue+0x18/0x61
 [&lt;ffffffff814c928f&gt;] skb_dequeue+0x18/0x61
 [&lt;ffffffffa009aa92&gt;] afs_deliver_to_call+0x344/0x39d [kafs]
 [&lt;ffffffffa009ab37&gt;] afs_process_async_call+0x4c/0xd5 [kafs]
 [&lt;ffffffffa0099e9c&gt;] afs_async_workfn+0xe/0x10 [kafs]
 [&lt;ffffffff81063a3a&gt;] process_one_work+0x29d/0x57c
 [&lt;ffffffff81064ac2&gt;] worker_thread+0x24a/0x385
 [&lt;ffffffff81064878&gt;] ? rescuer_thread+0x2d0/0x2d0
 [&lt;ffffffff810696f5&gt;] kthread+0xf3/0xfb
 [&lt;ffffffff8160a6ff&gt;] ret_from_fork+0x1f/0x40
 [&lt;ffffffff81069602&gt;] ? kthread_create_on_node+0x1cf/0x1cf

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rxrpc: Use RCU to access a peer's service connection tree</title>
<updated>2016-07-06T09:51:14+00:00</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2016-07-01T06:51:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=8496af50eb385c1cadff9ad396fd5359e96b6c27'/>
<id>8496af50eb385c1cadff9ad396fd5359e96b6c27</id>
<content type='text'>
Move to using RCU access to a peer's service connection tree when routing
an incoming packet.  This is done using a seqlock to trigger retrying of
the tree walk if a change happened.

Further, we no longer get a ref on the connection looked up in the
data_ready handler unless we queue the connection's work item - and then
only if the refcount &gt; 0.


Note that I'm avoiding the use of a hash table for service connections
because each service connection is addressed by a 62-bit number
(constructed from epoch and connection ID &gt;&gt; 2) that would allow the client
to engage in bucket stuffing, given knowledge of the hash algorithm.
Peers, however, are hashed as the network address is less controllable by
the client.  The total number of peers will also be limited in a future
commit.

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Move to using RCU access to a peer's service connection tree when routing
an incoming packet.  This is done using a seqlock to trigger retrying of
the tree walk if a change happened.

Further, we no longer get a ref on the connection looked up in the
data_ready handler unless we queue the connection's work item - and then
only if the refcount &gt; 0.


Note that I'm avoiding the use of a hash table for service connections
because each service connection is addressed by a 62-bit number
(constructed from epoch and connection ID &gt;&gt; 2) that would allow the client
to engage in bucket stuffing, given knowledge of the hash algorithm.
Peers, however, are hashed as the network address is less controllable by
the client.  The total number of peers will also be limited in a future
commit.

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>rxrpc: Move data_ready peer lookup into rxrpc_find_connection()</title>
<updated>2016-07-06T09:51:14+00:00</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2016-06-30T11:02:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=1291e9d1084506c5cba6313ce809d7516bb5868a'/>
<id>1291e9d1084506c5cba6313ce809d7516bb5868a</id>
<content type='text'>
Move the peer lookup done in input.c by data_ready into
rxrpc_find_connection().

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Move the peer lookup done in input.c by data_ready into
rxrpc_find_connection().

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rxrpc: Move usage count getting into rxrpc_queue_conn()</title>
<updated>2016-07-06T09:43:51+00:00</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2016-06-27T09:32:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=2c4579e4b1d5a6219522c6e970500b2fd43fe1f8'/>
<id>2c4579e4b1d5a6219522c6e970500b2fd43fe1f8</id>
<content type='text'>
Rather than calling rxrpc_get_connection() manually before calling
rxrpc_queue_conn(), do it inside the queue wrapper.

This allows us to do some important fixes:

 (1) If the usage count is 0, do nothing.  This prevents connections from
     being reanimated once they're dead.

 (2) If rxrpc_queue_work() fails because the work item is already queued,
     retract the usage count increment which would otherwise be lost.

 (3) Don't take a ref on the connection in the work function.  By passing
     the ref through the work item, this is unnecessary.  Doing it in the
     work function is too late anyway.  Previously, connection-directed
     packets held a ref on the connection, but that's not really the best
     idea.

And another useful changes:

 (*) Don't need to take a refcount on the connection in the data_ready
     handler unless we invoke the connection's work item.  We're using RCU
     there so that's otherwise redundant.

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Rather than calling rxrpc_get_connection() manually before calling
rxrpc_queue_conn(), do it inside the queue wrapper.

This allows us to do some important fixes:

 (1) If the usage count is 0, do nothing.  This prevents connections from
     being reanimated once they're dead.

 (2) If rxrpc_queue_work() fails because the work item is already queued,
     retract the usage count increment which would otherwise be lost.

 (3) Don't take a ref on the connection in the work function.  By passing
     the ref through the work item, this is unnecessary.  Doing it in the
     work function is too late anyway.  Previously, connection-directed
     packets held a ref on the connection, but that's not really the best
     idea.

And another useful changes:

 (*) Don't need to take a refcount on the connection in the data_ready
     handler unless we invoke the connection's work item.  We're using RCU
     there so that's otherwise redundant.

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rxrpc: Provide queuing helper functions</title>
<updated>2016-07-06T09:43:05+00:00</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2016-06-27T09:32:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=5acbee4648789ba1fe9e7942280fb1966c76bd6f'/>
<id>5acbee4648789ba1fe9e7942280fb1966c76bd6f</id>
<content type='text'>
Provide queueing helper functions so that the queueing of local and
connection objects can be fixed later.

The issue is that a ref on the object needs to be passed to the work queue,
but the act of queueing the object may fail because the object is already
queued.  Testing the queuedness of an object before hand doesn't work
because there can be a race with someone else trying to queue it.  What
will have to be done is to adjust the refcount depending on the result of
the queue operation.

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Provide queueing helper functions so that the queueing of local and
connection objects can be fixed later.

The issue is that a ref on the object needs to be passed to the work queue,
but the act of queueing the object may fail because the object is already
queued.  Testing the queuedness of an object before hand doesn't work
because there can be a race with someone else trying to queue it.  What
will have to be done is to adjust the refcount depending on the result of
the queue operation.

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rxrpc: Fix processing of authenticated/encrypted jumbo packets</title>
<updated>2016-07-01T07:35:02+00:00</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2016-07-01T07:35:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=ac5d26836cb6c01505d186180a79b4362ee7b4ac'/>
<id>ac5d26836cb6c01505d186180a79b4362ee7b4ac</id>
<content type='text'>
When a jumbo packet is being split up and processed, the crypto checksum
for each split-out packet is in the jumbo header and needs placing in the
reconstructed packet header.

When the code was changed to keep the stored copy of the packet header in
host byte order, this reconstruction was missed.

Found with sparse with CF=-D__CHECK_ENDIAN__:

    ../net/rxrpc/input.c:479:33: warning: incorrect type in assignment (different base types)
    ../net/rxrpc/input.c:479:33:    expected unsigned short [unsigned] [usertype] _rsvd
    ../net/rxrpc/input.c:479:33:    got restricted __be16 [addressable] [usertype] _rsvd

Fixes: 0d12f8a4027d021c9cc942f09f38d28288020c5d ("rxrpc: Keep the skb private record of the Rx header in host byte order")
Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When a jumbo packet is being split up and processed, the crypto checksum
for each split-out packet is in the jumbo header and needs placing in the
reconstructed packet header.

When the code was changed to keep the stored copy of the packet header in
host byte order, this reconstruction was missed.

Found with sparse with CF=-D__CHECK_ENDIAN__:

    ../net/rxrpc/input.c:479:33: warning: incorrect type in assignment (different base types)
    ../net/rxrpc/input.c:479:33:    expected unsigned short [unsigned] [usertype] _rsvd
    ../net/rxrpc/input.c:479:33:    got restricted __be16 [addressable] [usertype] _rsvd

Fixes: 0d12f8a4027d021c9cc942f09f38d28288020c5d ("rxrpc: Keep the skb private record of the Rx header in host byte order")
Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rxrpc: Kill off the rxrpc_transport struct</title>
<updated>2016-06-22T13:00:23+00:00</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2016-06-17T09:06:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=aa390bbe2113dd0de99cf35c39d7701d4412b744'/>
<id>aa390bbe2113dd0de99cf35c39d7701d4412b744</id>
<content type='text'>
The rxrpc_transport struct is now redundant, given that the rxrpc_peer
struct is now per peer port rather than per peer host, so get rid of it.

Service connection lists are transferred to the rxrpc_peer struct, as is
the conn_lock.  Previous patches moved the client connection handling out
of the rxrpc_transport struct and discarded the connection bundling code.

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The rxrpc_transport struct is now redundant, given that the rxrpc_peer
struct is now per peer port rather than per peer host, so get rid of it.

Service connection lists are transferred to the rxrpc_peer struct, as is
the conn_lock.  Previous patches moved the client connection handling out
of the rxrpc_transport struct and discarded the connection bundling code.

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
