From patchwork Tue Mar 12 23:37:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13590764 X-Patchwork-Delegate: kuba@kernel.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CE1604AED9 for ; Tue, 12 Mar 2024 23:37:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710286658; cv=none; b=JvoNIROpZtPMOo8mlpgHupGsDwYT2A4K4tlriWyyQ2HF88svDAEjMegpGdLIRG4Il872g1rUktcQ4nMq/U6vRP96VR76i28BgDEmBHDyUHbMTx8ZvrdBEAA3FFt3iDoWeY7Tro2tsA8kJOpNvJQp5ykKl7ur+mo/oEQBBBZYsig= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710286658; c=relaxed/simple; bh=yTIXu/sKqhCcK9sGsntr53/cH4qNlYidw+7xA1m4oXk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Fdh+gwKJuxUd6NoNmnukC76Mn2Z9jN6bltbvGuHVvwCUPhsM64qkXNbQPQC2M5diAnVicyLPd+IFgyzBU1od3emxGQkXQe7p87dy6TJQ6ZHu6Auz++qUZgoqF0AliiDxN2xqStY+9+NAcaHnTbvdVsfuXRAG0uAtv5QVO5k1zWI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=GiRRMYfl; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="GiRRMYfl" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710286655; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xOZDJSFUKIYqUSyAe6A//0kKA0XOQ3CbpICjDSiEJvc=; b=GiRRMYfl7ovHozpaG/HgMKqQClq3Zk3648mhtYfda61A6ggvnclMYlOZrhHBQ1L9h3Ur/u dY51yQ/v9UbgkzYK1ipc8HOr3KD0E325GZ4/2IaoRmHOBy57bc/PlY+hRqx4z4U57ggGtv QtFGTtdV5el6VEYQYbfYhf+gO/eS+gc= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-586-knBeSS_CMTGWUtT_AjoIhg-1; Tue, 12 Mar 2024 19:37:31 -0400 X-MC-Unique: knBeSS_CMTGWUtT_AjoIhg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id ED29C38035A6; Tue, 12 Mar 2024 23:37:30 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 49E0A2166BB6; Tue, 12 Mar 2024 23:37:29 +0000 (UTC) From: David Howells To: netdev@vger.kernel.org Cc: David Howells , Marc Dionne , Yunsheng Lin , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org, Alexander Duyck , "Michael S . Tsirkin" Subject: [PATCH net-next 1/2] rxrpc: Fix use of changed alignment param to page_frag_alloc_align() Date: Tue, 12 Mar 2024 23:37:17 +0000 Message-ID: <20240312233723.2984928-2-dhowells@redhat.com> In-Reply-To: <20240312233723.2984928-1-dhowells@redhat.com> References: <20240312233723.2984928-1-dhowells@redhat.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 X-Patchwork-Delegate: kuba@kernel.org 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 Reported-by: Marc Dionne cc: Yunsheng Lin cc: Alexander Duyck cc: Michael S. Tsirkin cc: "David S. Miller" cc: Eric Dumazet cc: Jakub Kicinski cc: Paolo Abeni 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); From patchwork Tue Mar 12 23:37:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13590763 X-Patchwork-Delegate: kuba@kernel.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E9014482FE for ; Tue, 12 Mar 2024 23:37:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710286657; cv=none; b=E3pkv7rdDbgpacLP4ID3H6O2vB5wn6t7joNx+4NDMGOm2F/QFN8RsEyLOlKyhit5gFAxcLoTsFEFJ3TGytwGFw/PyylB/nptUDTpYVrE2Fmf2kGPrnmOhfzYQM/CLKTK3clNXyxHTT1+BN2vx3PJabs1eo13aIGPdsFVBO/0Nak= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710286657; c=relaxed/simple; bh=w8JCsLSjSA3OkQoV28nEFem36dFCa/7sa9d7M6Kmb8g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LPjEJHc0eoB5xXTNNmWyiLBid7m+I3ely3vKvPn7/RuWb5rTqCblRaR57jGwP5LDXdJNffCtDFOVPy4hbJImJd6CqTiQSXB/lW/3yzW9hGp8e/7tZxCImguItpUfeUhv7lWdOtKCLHdRimaLVsOLeNngpVa61YVIFmRk7DvZYHA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=RwWmBRsQ; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="RwWmBRsQ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710286654; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9OX7Txmvz9CCuXto10fOD2XvYnGo3IOMbl07Vyopd3Y=; b=RwWmBRsQvm4iAsDjYPWINIGLJ8A4fEq3K3KieqexqPNg6hMlvoYa4JNMkzqRRQhanhtZ50 FS03V9GyqZUjF3JaJZ4tPcufTco8ynnGYagtTZSnbFM9hxeFanlMmZuc+xTDBSKkWOmy/7 DOyoMf6ELx+jThPbMMEWLV0UPh+qwe4= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-343-uMavIwFdNDGV7jNNc5g8HA-1; Tue, 12 Mar 2024 19:37:33 -0400 X-MC-Unique: uMavIwFdNDGV7jNNc5g8HA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C4527101A552; Tue, 12 Mar 2024 23:37:32 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8C54F10F53; Tue, 12 Mar 2024 23:37:31 +0000 (UTC) From: David Howells To: netdev@vger.kernel.org Cc: David Howells , Marc Dionne , Yunsheng Lin , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 2/2] rxrpc: Fix error check on ->alloc_txbuf() Date: Tue, 12 Mar 2024 23:37:18 +0000 Message-ID: <20240312233723.2984928-3-dhowells@redhat.com> In-Reply-To: <20240312233723.2984928-1-dhowells@redhat.com> References: <20240312233723.2984928-1-dhowells@redhat.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 X-Patchwork-Delegate: kuba@kernel.org 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 Reported-by: Marc Dionne cc: "David S. Miller" cc: Eric Dumazet cc: Jakub Kicinski cc: Paolo Abeni 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; } }