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 C91AF23BD03; Sat, 12 Sep 2026 12:14:59 +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=1789215300; cv=none; b=A3QY7qv6FyfeMU2zy4sffalrP6qDUlStJ6MO4FrqAx950Eu9YIAXyn9nZC3YHHLqVMP5uUVgsY1k42EWQPODPrxyMsvEzzUGqseeq6JIntYxRIqZAnkcAgvUfjCLWv5XjxknjINWFhmmQdl6Xt6DluvUzISV8SzGWP8razrefF0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789215300; c=relaxed/simple; bh=NIx6OoukwBZIFBTX8GLN3+ctxNtANwWraeMAMatX+sY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=g2GFGRjF/4g5bF5jEwWMpdEwLvLuq0UL4KpyrDxRxCygrmB/AeYprmDMKRlS8GA1WsToJOBJalU70AbEkFCeVIoOp0axPUjdPxg78yhSN+zTGeDZ5wSXKzr+VVBh5l6bQ0Gttqrf5e03VtMTRL8merTF+dueCV8v+QBzPt4EqkY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=uZOF2S4b; 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="uZOF2S4b" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 364EF1F000FF; Sat, 12 Sep 2026 12:14:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789215299; bh=NTQkZYHWBIHrCYgRSZwycb81ljig4z4xKMXMaspYSAs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=uZOF2S4btEB4cSJrxZWEBhwRvL0BnOuc8UtN6BunD6izrpD3mo6FkmbiSMEOUC2sX rOlIf3tAwwm6CiACAt/BuJKsDj52A6zKvKxY/ZGi5aqcZzXKRmKg11YgKOunVFGMO9 w99ZSMxUkk2/eLazgxyb9aJgEonYyYyAIftHxgd4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Sebastian Andrzej Siewior , Leon Romanovsky , Sasha Levin Subject: [PATCH 6.12 0502/1376] RDMA/mlx5: Drain RCU callbacks during module teardown Date: Sat, 12 Sep 2026 08:48:48 +0200 Message-ID: <20260912065618.727902758@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065607.535295758@linuxfoundation.org> References: <20260912065607.535295758@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.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Leon Romanovsky [ Upstream commit e37cdd75f8d61c1123d324ae5667ac3da562290e ] devx_free_subscription() can remain queued after the last DevX event file drops its module reference or an auxiliary driver detaches its devices. mlx5_ib can then unload before the callback runs. Registration error unwind has the same risk because driver registration can attach existing devices before failing. Wait after all drivers have stopped. Fixes: 6898d1c661d7 ("RDMA/mlx5: Use RCU and direct refcounts to keep memory alive") Reported-by: Sebastian Andrzej Siewior Closes: https://lore.kernel.org/linux-rdma/20260708092316.Qb39F_B0@linutronix.de/ Link: https://patch.msgid.link/20260709-unload-rcu-v1-2-fccd27211e5a@nvidia.com Acked-by: Sebastian Andrzej Siewior Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin --- drivers/infiniband/hw/mlx5/main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c index edd38510c0259..a0b3086381951 100644 --- a/drivers/infiniband/hw/mlx5/main.c +++ b/drivers/infiniband/hw/mlx5/main.c @@ -5101,6 +5101,7 @@ static int __init mlx5_ib_init(void) dd_err: mlx5r_rep_cleanup(); rep_err: + rcu_barrier(); mlx5_ib_qp_event_cleanup(); qp_event_err: destroy_workqueue(mlx5_ib_event_wq); @@ -5114,6 +5115,7 @@ static void __exit mlx5_ib_cleanup(void) auxiliary_driver_unregister(&mlx5r_driver); auxiliary_driver_unregister(&mlx5r_mp_driver); mlx5r_rep_cleanup(); + rcu_barrier(); mlx5_ib_qp_event_cleanup(); destroy_workqueue(mlx5_ib_event_wq); -- 2.53.0