* [PATCH net-next 1/2] rxrpc: Fix use of changed alignment param to page_frag_alloc_align()
2024-03-12 23:37 [PATCH net-next 0/2] rxrpc: Fixes for AF_RXRPC David Howells
@ 2024-03-12 23:37 ` David Howells
2024-03-12 23:37 ` [PATCH net-next 2/2] rxrpc: Fix error check on ->alloc_txbuf() David Howells
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: David Howells @ 2024-03-12 23:37 UTC (permalink / raw)
To: netdev
Cc: David Howells, Marc Dionne, Yunsheng Lin, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, linux-afs,
linux-kernel, Alexander Duyck, Michael S . Tsirkin
Commit 411c5f36805c ("mm/page_alloc: modify page_frag_alloc_align() to
accept align as an argument") changed the way page_frag_alloc_align()
worked, but it didn't fix AF_RXRPC as that use of that allocator function
hadn't been merged yet at the time. Now, when the AFS filesystem is used,
this results in:
WARNING: CPU: 4 PID: 379 at include/linux/gfp.h:323 rxrpc_alloc_data_txbuf+0x9d/0x2b0 [rxrpc]
Fix this by using __page_frag_alloc_align() instead.
Note that it might be better to use an order-based alignment rather than a
mask-based alignment.
Fixes: 49489bb03a50 ("rxrpc: Do zerocopy using MSG_SPLICE_PAGES and page frags")
Signed-off-by: David Howells <dhowells@redhat.com>
Reported-by: Marc Dionne <marc.dionne@auristor.com>
cc: Yunsheng Lin <linyunsheng@huawei.com>
cc: Alexander Duyck <alexander.duyck@gmail.com>
cc: Michael S. Tsirkin <mst@redhat.com>
cc: "David S. Miller" <davem@davemloft.net>
cc: Eric Dumazet <edumazet@google.com>
cc: Jakub Kicinski <kuba@kernel.org>
cc: Paolo Abeni <pabeni@redhat.com>
cc: linux-afs@lists.infradead.org
cc: netdev@vger.kernel.org
---
net/rxrpc/txbuf.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/rxrpc/txbuf.c b/net/rxrpc/txbuf.c
index b2a82ab756c2..e0679658d9de 100644
--- a/net/rxrpc/txbuf.c
+++ b/net/rxrpc/txbuf.c
@@ -33,8 +33,8 @@ struct rxrpc_txbuf *rxrpc_alloc_data_txbuf(struct rxrpc_call *call, size_t data_
total = hoff + sizeof(*whdr) + data_size;
mutex_lock(&call->conn->tx_data_alloc_lock);
- buf = page_frag_alloc_align(&call->conn->tx_data_alloc, total, gfp,
- ~(data_align - 1) & ~(L1_CACHE_BYTES - 1));
+ buf = __page_frag_alloc_align(&call->conn->tx_data_alloc, total, gfp,
+ ~(data_align - 1) & ~(L1_CACHE_BYTES - 1));
mutex_unlock(&call->conn->tx_data_alloc_lock);
if (!buf) {
kfree(txb);
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH net-next 2/2] rxrpc: Fix error check on ->alloc_txbuf()
2024-03-12 23:37 [PATCH net-next 0/2] rxrpc: Fixes for AF_RXRPC David Howells
2024-03-12 23:37 ` [PATCH net-next 1/2] rxrpc: Fix use of changed alignment param to page_frag_alloc_align() David Howells
@ 2024-03-12 23:37 ` David Howells
2024-03-13 8:17 ` [PATCH net-next 0/2] rxrpc: Fixes for AF_RXRPC David Howells
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: David Howells @ 2024-03-12 23:37 UTC (permalink / raw)
To: netdev
Cc: David Howells, Marc Dionne, Yunsheng Lin, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, linux-afs,
linux-kernel
rxrpc_alloc_*_txbuf() and ->alloc_txbuf() return NULL to indicate no
memory, but rxrpc_send_data() uses IS_ERR().
Fix rxrpc_send_data() to check for NULL only and set -ENOMEM if it sees
that.
Fixes: 49489bb03a50 ("rxrpc: Do zerocopy using MSG_SPLICE_PAGES and page frags")
Signed-off-by: David Howells <dhowells@redhat.com>
Reported-by: Marc Dionne <marc.dionne@auristor.com>
cc: "David S. Miller" <davem@davemloft.net>
cc: Eric Dumazet <edumazet@google.com>
cc: Jakub Kicinski <kuba@kernel.org>
cc: Paolo Abeni <pabeni@redhat.com>
cc: linux-afs@lists.infradead.org
cc: netdev@vger.kernel.org
---
net/rxrpc/sendmsg.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/rxrpc/sendmsg.c b/net/rxrpc/sendmsg.c
index 6f765768c49c..894b8fa68e5e 100644
--- a/net/rxrpc/sendmsg.c
+++ b/net/rxrpc/sendmsg.c
@@ -349,8 +349,8 @@ static int rxrpc_send_data(struct rxrpc_sock *rx,
*/
remain = more ? INT_MAX : msg_data_left(msg);
txb = call->conn->security->alloc_txbuf(call, remain, sk->sk_allocation);
- if (IS_ERR(txb)) {
- ret = PTR_ERR(txb);
+ if (!txb) {
+ ret = -ENOMEM;
goto maybe_error;
}
}
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH net-next 0/2] rxrpc: Fixes for AF_RXRPC
2024-03-12 23:37 [PATCH net-next 0/2] rxrpc: Fixes for AF_RXRPC David Howells
2024-03-12 23:37 ` [PATCH net-next 1/2] rxrpc: Fix use of changed alignment param to page_frag_alloc_align() David Howells
2024-03-12 23:37 ` [PATCH net-next 2/2] rxrpc: Fix error check on ->alloc_txbuf() David Howells
@ 2024-03-13 8:17 ` David Howells
2024-03-13 11:14 ` [PATCH net-next 1/2] rxrpc: Fix use of changed alignment param to page_frag_alloc_align() David Howells
2024-03-14 12:20 ` [PATCH net-next 0/2] rxrpc: Fixes for AF_RXRPC patchwork-bot+netdevbpf
4 siblings, 0 replies; 6+ messages in thread
From: David Howells @ 2024-03-13 8:17 UTC (permalink / raw)
To: netdev
Cc: dhowells, Marc Dionne, Yunsheng Lin, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, linux-afs,
linux-kernel
David Howells <dhowells@redhat.com> wrote:
> Here are a couple of fixes for the AF_RXRPC changes[1] in net-next.
Actually, this should be aimed at net now that net-next got merged.
David
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next 1/2] rxrpc: Fix use of changed alignment param to page_frag_alloc_align()
2024-03-12 23:37 [PATCH net-next 0/2] rxrpc: Fixes for AF_RXRPC David Howells
` (2 preceding siblings ...)
2024-03-13 8:17 ` [PATCH net-next 0/2] rxrpc: Fixes for AF_RXRPC David Howells
@ 2024-03-13 11:14 ` David Howells
2024-03-14 12:20 ` [PATCH net-next 0/2] rxrpc: Fixes for AF_RXRPC patchwork-bot+netdevbpf
4 siblings, 0 replies; 6+ messages in thread
From: David Howells @ 2024-03-13 11:14 UTC (permalink / raw)
To: netdev
Cc: dhowells, Marc Dionne, Yunsheng Lin, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, linux-afs,
linux-kernel, Alexander Duyck, Michael S . Tsirkin
Reported-and-tested-by: syzbot+150fa730f40bce72aa05@syzkaller.appspotmail.com
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH net-next 0/2] rxrpc: Fixes for AF_RXRPC
2024-03-12 23:37 [PATCH net-next 0/2] rxrpc: Fixes for AF_RXRPC David Howells
` (3 preceding siblings ...)
2024-03-13 11:14 ` [PATCH net-next 1/2] rxrpc: Fix use of changed alignment param to page_frag_alloc_align() David Howells
@ 2024-03-14 12:20 ` patchwork-bot+netdevbpf
4 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-03-14 12:20 UTC (permalink / raw)
To: David Howells
Cc: netdev, marc.dionne, linyunsheng, davem, edumazet, kuba, pabeni,
linux-afs, linux-kernel
Hello:
This series was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:
On Tue, 12 Mar 2024 23:37:16 +0000 you wrote:
> Here are a couple of fixes for the AF_RXRPC changes[1] in net-next.
>
> (1) Fix a runtime warning introduced by a patch that changed how
> page_frag_alloc_align() works.
>
> (2) Fix an is-NULL vs IS_ERR error handling bug.
>
> [...]
Here is the summary with links:
- [net-next,1/2] rxrpc: Fix use of changed alignment param to page_frag_alloc_align()
https://git.kernel.org/netdev/net/c/6b2536462fd4
- [net-next,2/2] rxrpc: Fix error check on ->alloc_txbuf()
https://git.kernel.org/netdev/net/c/89e4354110ca
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 6+ messages in thread