From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796564007; b=EEyZAY/ChA2/u215/8YD5I//4O0DbG2Y87p5SXGpPGYSXF7Idk1dq7CkIg7OXvm2Xlf0 7JTezIPa6KflVyriSS38S6Qjd1bVDo2rH1+KVvv1QF+q5OiIAJ5gobueXXg8kdsmVZC5p WsZ57VLN5HZG5p20I17byFk1/IGXDaPlcTeTNGmmCIa4yVTzaV/YsJDNkhClEttSn1rn/ wtXLLaKbG581jOidEQKR66ApVcF4sNPndVU9QenH0g9MQ/txzY1rjnWJ5jmhTicGkv7ro wYzn/K9+Pld4v4x4el3yJWP7dSFXvZ54J7/aZhJwiujaZME3j041c1Z8v6wVMJjoWPQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796564007; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=5f5mKKOQ8DrSjcpJTfZmc5BeeysUsWLhNBm4+QBE9cg=; b=OaKWu1vr8Zgkk3m9QSs7QdAZiPL3b7K3qC4ByIc1Aq0NWIjxT2cXGriQgNUHxz29IoQA dcClEbD5nNss6ivNAJnNYd/sCnEmbhbPN3aoDVuFrCk7xwoSlA1oFul1glg00dwlzM9np 1j45xZAVNZroK2GiFU+sNSzmZ663R6LPK6Fm7yCyX64nWqsh1FYUtY1A1q537wqnKKgrm viIdw/khIvqpONewZex+TY2T6BEs52M2fmuZmzM8hFzt+v4JZ5+i5It6L8ID9yWj9pQXR sXAElyc/Lk0Uv6cbSPjVyE62OpneZ0DG34HzTJfAHvyVAAHapfhj5R78aFZECztpJiQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=hFrFhubp; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9086A606A32F for ; Sun, 6 Dec 2026 13:33:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=hFrFhubp Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0AD151F0093B; Sun, 6 Dec 2026 13:33:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796564007; bh=5f5mKKOQ8DrSjcpJTfZmc5BeeysUsWLhNBm4+QBE9cg=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=hFrFhubp7rMeypFD6Vt8yF2aUv6M+hxd4KSSiRd36/EUOf0dSH8OQ7pawmYgv6f5Y IJ769TXijDBtrGW6247KqgbCEQsK4t3Ow/CCEEAaNC+BetlAW5N3GCeHMj8TWcE5m+ G44Qb0ebPIoaD88SXlnVUJAZ3IDF1/qMKVGnFYVVvFUQH3H1zOH4SsMFAWvZrPGfZo ZTibBVqsHIsna6tfMPD7oqyS1Xt0FV/wY2Hc26aauarVdtrDl5doE0bTjzRKSf3/hc 6zNdcJgZ8tY73h6odBkoXmp7F80k81NmgAbG4gBryhzu9CdG2kNuMuXUbnZsuRYKmJ VwNJY8yclvoOg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH] RDMA/cma: Cancel the route query before dropping handler_mutex on removal Reply-To: sashiko-reviews@lists.linux.dev To: "Jiayi Zhang" Cc: linux-rdma@vger.kernel.org In-Reply-To: <20261206131441.1767711-1-zhangjiayi1014@gmail.com> References: <20261206131441.1767711-1-zhangjiayi1014@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sun, 06 Dec 2026 13:33:26 +0000 X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list > When an RDMA device is removed, cma_send_device_removal_put() moves the > ID to RDMA_CM_DEVICE_REMOVAL, delivers the event to the ULP, drops > handler_mutex and then calls cma_cancel_operation() with the previous > state. >=20 > The ULP may destroy the ID as soon as handler_mutex is dropped; ucma > does this from its close_work. destroy_id_handler_unlock() sees > RDMA_CM_DEVICE_REMOVAL, leaves the cancel to the removal thread, and > _destroy_id() calls cma_release_dev(), which sets id_priv->id.device to > NULL. The reference held by the removal thread keeps id_priv alive, but > if the previous state was RDMA_CM_ROUTE_QUERY, cma_cancel_route() then > reads the cleared device: >=20 > KASAN: null-ptr-deref in range [0x0000000000000798-0x000000000000079f] > RIP: 0010:rdma_cap_ib_sa include/rdma/ib_verbs.h:3563 [inline] > [ ... ] > Fixes: 3647a28de1ad ("RDMA/cma: Using the standard locking pattern when d= elivering the removal event") > Fixes: 889d916b6f8a ("RDMA/core: Don't access cm_id after its destruction= ") > Reported-by: syzbot+9a9d0804227064a915d3@syzkaller.appspotmail.com > Closes: https://lore.kernel.org/all/6b14cd41.7375a9b9.1d867b.10ff.GAE@goo= gle.com/ > Signed-off-by: Jiayi Zhang Sashiko has reviewed this patch and found no issues. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261206131441.1767= 711-1-zhangjiayi1014@gmail.com?part=3D1