<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-stable.git/net/rxrpc, 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: Don't access connection from call if pointer is NULL</title>
<updated>2016-08-09T16:12:23+00:00</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2016-08-08T09:27:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=f9dc575725baeaad8eb5262589f9aebeeaf13433'/>
<id>f9dc575725baeaad8eb5262589f9aebeeaf13433</id>
<content type='text'>
The call state machine processor sets up the message parameters for a UDP
message that it might need to transmit in advance on the basis that there's
a very good chance it's going to have to transmit either an ACK or an
ABORT.  This requires it to look in the connection struct to retrieve some
of the parameters.

However, if the call is complete, the call connection pointer may be NULL
to dissuade the processor from transmitting a message.  However, there are
some situations where the processor is still going to be called - and it's
still going to set up message parameters whether it needs them or not.

This results in a NULL pointer dereference at:

	net/rxrpc/call_event.c:837

To fix this, skip the message pre-initialisation if there's no connection
attached.

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The call state machine processor sets up the message parameters for a UDP
message that it might need to transmit in advance on the basis that there's
a very good chance it's going to have to transmit either an ACK or an
ABORT.  This requires it to look in the connection struct to retrieve some
of the parameters.

However, if the call is complete, the call connection pointer may be NULL
to dissuade the processor from transmitting a message.  However, there are
some situations where the processor is still going to be called - and it's
still going to set up message parameters whether it needs them or not.

This results in a NULL pointer dereference at:

	net/rxrpc/call_event.c:837

To fix this, skip the message pre-initialisation if there's no connection
attached.

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rxrpc: Need to flag call as being released on connect failure</title>
<updated>2016-08-09T16:12:23+00:00</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2016-08-08T12:06:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=17b963e319449f709e78dc1ef445d797a13eecbc'/>
<id>17b963e319449f709e78dc1ef445d797a13eecbc</id>
<content type='text'>
If rxrpc_new_client_call() fails to make a connection, the call record that
it allocated needs to be marked as RXRPC_CALL_RELEASED before it is passed
to rxrpc_put_call() to indicate that it no longer has any attachment to the
AF_RXRPC socket.

Without this, an assertion failure may occur at:

	net/rxrpc/call_object:635

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If rxrpc_new_client_call() fails to make a connection, the call record that
it allocated needs to be marked as RXRPC_CALL_RELEASED before it is passed
to rxrpc_put_call() to indicate that it no longer has any attachment to the
AF_RXRPC socket.

Without this, an assertion failure may occur at:

	net/rxrpc/call_object:635

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rxrpc: fix uninitialized pointer dereference in debug code</title>
<updated>2016-08-09T09:51:38+00:00</updated>
<author>
<name>Arnd Bergmann</name>
<email>arnd@arndb.de</email>
</author>
<published>2016-08-08T10:13:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=55cae7a403f3b52de3dd6e4a614582541c9631af'/>
<id>55cae7a403f3b52de3dd6e4a614582541c9631af</id>
<content type='text'>
A newly added bugfix caused an uninitialized variable to be
used for printing debug output. This is harmless as long
as the debug setting is disabled, but otherwise leads to an
immediate crash.

gcc warns about this when -Wmaybe-uninitialized is enabled:

net/rxrpc/call_object.c: In function 'rxrpc_release_call':
net/rxrpc/call_object.c:496:163: error: 'sp' may be used uninitialized in this function [-Werror=maybe-uninitialized]

The initialization was removed but one of the users remains.
This adds back the initialization.

Signed-off-by: Arnd Bergmann &lt;arnd@arndb.de&gt;
Fixes: 372ee16386bb ("rxrpc: Fix races between skb free, ACK generation and replying")
Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
A newly added bugfix caused an uninitialized variable to be
used for printing debug output. This is harmless as long
as the debug setting is disabled, but otherwise leads to an
immediate crash.

gcc warns about this when -Wmaybe-uninitialized is enabled:

net/rxrpc/call_object.c: In function 'rxrpc_release_call':
net/rxrpc/call_object.c:496:163: error: 'sp' may be used uninitialized in this function [-Werror=maybe-uninitialized]

The initialization was removed but one of the users remains.
This adds back the initialization.

Signed-off-by: Arnd Bergmann &lt;arnd@arndb.de&gt;
Fixes: 372ee16386bb ("rxrpc: Fix races between skb free, ACK generation and replying")
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: checking for IS_ERR() instead of NULL</title>
<updated>2016-07-15T21:16:25+00:00</updated>
<author>
<name>Dan Carpenter</name>
<email>dan.carpenter@oracle.com</email>
</author>
<published>2016-07-14T14:47:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=7acef60455c4814a52afb8629d166a3b4dfa0ebb'/>
<id>7acef60455c4814a52afb8629d166a3b4dfa0ebb</id>
<content type='text'>
The rxrpc_lookup_peer() function returns NULL on error, it never returns
error pointers.

Fixes: 8496af50eb38 ('rxrpc: Use RCU to access a peer's service connection tree')
Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
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>
The rxrpc_lookup_peer() function returns NULL on error, it never returns
error pointers.

Fixes: 8496af50eb38 ('rxrpc: Use RCU to access a peer's service connection tree')
Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
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: Fix error handling in af_rxrpc_init()</title>
<updated>2016-07-12T18:07:38+00:00</updated>
<author>
<name>Wei Yongjun</name>
<email>yongjun_wei@trendmicro.com.cn</email>
</author>
<published>2016-07-12T11:21:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=8addc0440bdba9280bf212b70f17f029c2801805'/>
<id>8addc0440bdba9280bf212b70f17f029c2801805</id>
<content type='text'>
security initialized after alloc workqueue, so we should exit security
before destroy workqueue in the error handing.

Fixes: 648af7fca159 ("rxrpc: Absorb the rxkad security module")
Signed-off-by: Wei Yongjun &lt;yongjun_wei@trendmicro.com.cn&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>
security initialized after alloc workqueue, so we should exit security
before destroy workqueue in the error handing.

Fixes: 648af7fca159 ("rxrpc: Absorb the rxkad security module")
Signed-off-by: Wei Yongjun &lt;yongjun_wei@trendmicro.com.cn&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rxrpc: Kill off the call hash table</title>
<updated>2016-07-06T10:23:54+00:00</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2016-07-05T09:57:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=d440a1ce5d2cf9d90390f6c0d8badc4c0a4f8b6b'/>
<id>d440a1ce5d2cf9d90390f6c0d8badc4c0a4f8b6b</id>
<content type='text'>
The call hash table is now no longer used as calls are looked up directly
by channel slot on the connection, so kill it off.

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The call hash table is now no longer used as calls are looked up directly
by channel slot on the connection, so kill it off.

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