From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 1BF932E62B7; Sat, 30 May 2026 16:44:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780159474; cv=none; b=rAik23o4+I7pSW44o3P53Rb021dIchZEtdGOgrdURG7+bkfjCC7Vblsz1MO+XBcIvB3oo6ESKjwsgsi4Zl5gBCTYlkCysLCY0UpGFj+m83+XLPT6JxXluNW6eJx7L7gUZGZItbXhQ/FmKxhI0nyg1f/Mfngeb3JeU+5MZU05P5o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780159474; c=relaxed/simple; bh=EI8zb9DO1W8FwXQ7YYC67kUPtn0NeShc3udg/vaG+aE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kjnoZr3ZDLCIkQiEwtJ7xGdO3mWUDQuP7yIiki8viwBjq5e0E/X5XGP7R+k61xPzSxx+GM5HnzZbg2PGAPl8ZCyMwjDiL9dX7TQJOPyBJa2JTg2JdvBafuG4chGkv7Jucnm3INTz9tiilcl3sDBo9C39Kqoc4kbst3yY0In3g28= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ymYtfVn7; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="ymYtfVn7" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 566541F00893; Sat, 30 May 2026 16:44:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780159473; bh=HUqjDty3w8TkKARG0GSvYh77iy7t3EjmYlSLCK2jOQQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ymYtfVn7kegJy/KDiEPxHqnic64CgaNS2TaejJojwuePC5v1pNQktZbd9tyuS82Cq XRkoKlf05pi9nyaLY2+DdR2UOkRy5tEKzR1w1MOREujEDys23Qkfvua+Wps2jNVomO KN9N6dQHooChfQGYdMZ/YWDZCIaQE771XTGAVQMA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, David Howells , Marc Dionne , Jeffrey Altman , Linus Torvalds , Simon Horman , linux-afs@lists.infradead.org, stable@kernel.org, Jakub Kicinski , Sasha Levin Subject: [PATCH 6.1 125/969] rxrpc: Fix call removal to use RCU safe deletion Date: Sat, 30 May 2026 17:54:09 +0200 Message-ID: <20260530160303.999839337@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260530160300.485627683@linuxfoundation.org> References: <20260530160300.485627683@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: David Howells [ Upstream commit 146d4ab94cf129ee06cd467cb5c71368a6b5bad6 ] Fix rxrpc call removal from the rxnet->calls list to use list_del_rcu() rather than list_del_init() to prevent stuffing up reading /proc/net/rxrpc/calls from potentially getting into an infinite loop. This, however, means that list_empty() no longer works on an entry that's been deleted from the list, making it harder to detect prior deletion. Fix this by: Firstly, make rxrpc_destroy_all_calls() only dump the first ten calls that are unexpectedly still on the list. Limiting the number of steps means there's no need to call cond_resched() or to remove calls from the list here, thereby eliminating the need for rxrpc_put_call() to check for that. rxrpc_put_call() can then be fixed to unconditionally delete the call from the list as it is the only place that the deletion occurs. Fixes: 2baec2c3f854 ("rxrpc: Support network namespacing") Closes: https://sashiko.dev/#/patchset/20260319150150.4189381-1-dhowells%40redhat.com Signed-off-by: David Howells cc: Marc Dionne cc: Jeffrey Altman cc: Linus Torvalds cc: Simon Horman cc: linux-afs@lists.infradead.org cc: stable@kernel.org Link: https://patch.msgid.link/20260408121252.2249051-5-dhowells@redhat.com Signed-off-by: Jakub Kicinski [ adapted to older API ] Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- net/rxrpc/call_object.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) --- a/net/rxrpc/call_object.c +++ b/net/rxrpc/call_object.c @@ -634,11 +634,9 @@ void rxrpc_put_call(struct rxrpc_call *c _debug("call %d dead", call->debug_id); ASSERTCMP(call->state, ==, RXRPC_CALL_COMPLETE); - if (!list_empty(&call->link)) { - spin_lock_bh(&rxnet->call_lock); - list_del_init(&call->link); - spin_unlock_bh(&rxnet->call_lock); - } + spin_lock_bh(&rxnet->call_lock); + list_del_rcu(&call->link); + spin_unlock_bh(&rxnet->call_lock); rxrpc_cleanup_call(call); } @@ -709,24 +707,20 @@ void rxrpc_destroy_all_calls(struct rxrp _enter(""); if (!list_empty(&rxnet->calls)) { - spin_lock_bh(&rxnet->call_lock); + int shown = 0; - while (!list_empty(&rxnet->calls)) { - call = list_entry(rxnet->calls.next, - struct rxrpc_call, link); - _debug("Zapping call %p", call); + spin_lock_bh(&rxnet->call_lock); + list_for_each_entry(call, &rxnet->calls, link) { rxrpc_see_call(call); - list_del_init(&call->link); pr_err("Call %p still in use (%d,%s,%lx,%lx)!\n", call, refcount_read(&call->ref), rxrpc_call_states[call->state], call->flags, call->events); - spin_unlock_bh(&rxnet->call_lock); - cond_resched(); - spin_lock_bh(&rxnet->call_lock); + if (++shown >= 10) + break; } spin_unlock_bh(&rxnet->call_lock);