mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [syzbot] [rdma?] WARNING in rdma_resolve_addr
@ 2026-11-01  5:32 syzbot
  2026-11-01  8:17 ` Forwarded: [PATCH] RDMA/cma: Don't warn when device removal races with rdma_resolve_addr() syzbot
  0 siblings, 1 reply; 3+ messages in thread
From: syzbot @ 2026-11-01  5:32 UTC (permalink / raw)
  To: linux-kernel, linux-rdma, syzkaller-bugs

Hello,

syzbot found the following issue on:

HEAD commit:    36aad21d50d1 Merge tag 'ksmbd-for-7.4-rc1-part2' of git://..
git tree:       git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=1364b795580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=37ec6334ca3b8e94
dashboard link: https://syzkaller.appspot.com/bug?extid=6699995b421c8ec7d2fe
compiler:       gcc (Debian 14.2.0-19) 14.2.0, GNU ld (GNU Binutils for Debian) 2.44
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=1752b159580000

AI-generated root cause summary:
A race condition exists in resolve_prepare_src() in
drivers/infiniband/core/cma.c when binding an address during
rdma_resolve_addr(). Calling cma_bind_addr() transitions id_priv->state to
RDMA_CM_ADDR_BOUND and attaches id_priv to cma_dev->id_list, exposing it to
concurrent device removal via cma_process_remove() /
cma_send_device_removal_put(), which sets id_priv->state to
RDMA_CM_DEVICE_REMOVAL. When this occurs before resolve_prepare_src() executes
cma_comp_exch(id_priv, RDMA_CM_ADDR_BOUND, RDMA_CM_ADDR_QUERY), the state check
fails and triggers a false-positive WARN_ON(), returning -EINVAL which is
handled cleanly by callers without memory corruption or DoS.

full analysis:  https://syzkaller.appspot.com/x/ai_root_cause?x=6699995b421c8ec7d2fe

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+6699995b421c8ec7d2fe@syzkaller.appspotmail.com

------------[ cut here ]------------
!cma_comp_exch(id_priv, RDMA_CM_ADDR_BOUND, RDMA_CM_ADDR_QUERY)
WARNING: drivers/infiniband/core/cma.c:4120 at resolve_prepare_src drivers/infiniband/core/cma.c:4120 [inline], CPU#1: kworker/u8:8/1176
WARNING: drivers/infiniband/core/cma.c:4120 at rdma_resolve_addr+0x3f1/0x20e0 drivers/infiniband/core/cma.c:4146, CPU#1: kworker/u8:8/1176
Modules linked in:
CPU: 1 UID: 0 PID: 1176 Comm: kworker/u8:8 Not tainted syzkaller #0 PREEMPT(full) 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/05/2026
Workqueue: krds_cp_wq#43/0 rds_connect_worker
RIP: 0010:resolve_prepare_src drivers/infiniband/core/cma.c:4120 [inline]
RIP: 0010:rdma_resolve_addr+0x3f1/0x20e0 drivers/infiniband/core/cma.c:4146
Code: 02 00 00 44 89 f6 e8 3e f2 14 f9 41 83 fe 07 0f 84 09 07 00 00 e8 bf f7 14 f9 48 8b bd 18 ff ff ff 48 89 de e8 10 3f f7 02 90 <0f> 0b 90 bb ea ff ff ff e9 57 fd ff ff e8 9d f7 14 f9 49 8d 7c 24
RSP: 0018:ffffc900052ff8b0 EFLAGS: 00010286
RAX: 8000000000000001 RBX: 0000000000000293 RCX: 0000000000000000
RDX: 0000000000000004 RSI: ffffffff8e6277e2 RDI: 0000000000000001
RBP: ffffc900052ffa00 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000001 R11: 0000000000000000 R12: ffffc900052ffb00
R13: 0000000000001388 R14: 0000000000000009 R15: ffffc900052ffa60
FS:  0000000000000000(0000) GS:ffff88812257f000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000560c3d47e9f8 CR3: 0000000020ebc000 CR4: 00000000003526f0
Call Trace:
 <TASK>
 rds_ib_conn_path_connect+0x415/0x5d0 net/rds/ib_cm.c:1044
 rds_connect_worker+0x1b4/0x2d0 net/rds/threads.c:176
 process_one_work+0xac7/0x1b10 kernel/workqueue.c:3495
 process_scheduled_works kernel/workqueue.c:3578 [inline]
 worker_thread+0x5ef/0xe50 kernel/workqueue.c:3659
 kthread+0x373/0x450 kernel/kthread.c:436
 ret_from_fork+0x730/0xd60 arch/x86/kernel/process.c:158
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
 </TASK>


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Forwarded: [PATCH] RDMA/cma: Don't warn when device removal races with rdma_resolve_addr()
  2026-11-01  5:32 [syzbot] [rdma?] WARNING in rdma_resolve_addr syzbot
@ 2026-11-01  8:17 ` syzbot
  0 siblings, 0 replies; 3+ messages in thread
From: syzbot @ 2026-11-01  8:17 UTC (permalink / raw)
  To: linux-kernel, syzkaller-bugs

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.

***

Subject: [PATCH] RDMA/cma: Don't warn when device removal races with rdma_resolve_addr()
Author: kartikey406@gmail.com

#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master


rdma_resolve_addr() on an unbound ID (RDMA_CM_IDLE) first binds it with
cma_bind_addr() and then moves it from RDMA_CM_ADDR_BOUND to
RDMA_CM_ADDR_QUERY with a second cma_comp_exch(). These are two
separate steps. Once the ID is bound it is attached to the device, so
cma_send_device_removal_put() can find it and set RDMA_CM_DEVICE_REMOVAL
before the second step runs. The exchange then fails and hits the
WARN_ON() added by the commit below.

syzbot triggers this with RDS over rxe, where rds_connect_worker()
calls rdma_resolve_addr() while the rxe device is being deleted:

  WARNING: drivers/infiniband/core/cma.c:4120 at resolve_prepare_src
  Call Trace:
   rdma_resolve_addr
   rds_ib_conn_path_connect
   rds_connect_worker

This is a valid race and not a kernel bug. If removal wins before the
bind, cma_bind_addr() already fails and the error is returned to the
caller, and err_state in the same function already ignores a failed
state exchange. The caller gets -EINVAL, and RDS destroys the ID on any
error from rdma_resolve_addr(), so nothing is leaked.

Drop the WARN_ON() and keep returning -EINVAL, and document in a comment
that the state may change because of device removal.

Reported-by: syzbot+6699995b421c8ec7d2fe@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=6699995b421c8ec7d2fe
Fixes: 732d41c545bb ("RDMA/cma: Make the locking for automatic state transition more clear")
Signed-off-by: Deepanshu Kartikey <kartikey406@gmail.com>
---
 drivers/infiniband/core/cma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index 337a49d1acf7..46741c1fd34b 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -4117,8 +4117,8 @@ static int resolve_prepare_src(struct rdma_id_private *id_priv,
 		ret = cma_bind_addr(&id_priv->id, src_addr, dst_addr);
 		if (ret)
 			return ret;
-		if (WARN_ON(!cma_comp_exch(id_priv, RDMA_CM_ADDR_BOUND,
-					   RDMA_CM_ADDR_QUERY)))
+		if (!cma_comp_exch(id_priv, RDMA_CM_ADDR_BOUND,
+			           RDMA_CM_ADDR_QUERY))
 			return -EINVAL;
 
 	} else {
-- 
2.43.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [syzbot] [rdma?] WARNING in rdma_resolve_addr
       [not found] <20261101081710.19095-1-kartikey406@gmail.com>
@ 2026-11-01  8:52 ` syzbot
  0 siblings, 0 replies; 3+ messages in thread
From: syzbot @ 2026-11-01  8:52 UTC (permalink / raw)
  To: kartikey406, linux-kernel, syzkaller-bugs

Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-by: syzbot+6699995b421c8ec7d2fe@syzkaller.appspotmail.com
Tested-by: syzbot+6699995b421c8ec7d2fe@syzkaller.appspotmail.com

Tested on:

commit:         cbbddb6b Merge tag 'power-utilities-2026.10.31' of git..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1688cbe0580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=37ec6334ca3b8e94
dashboard link: https://syzkaller.appspot.com/bug?extid=6699995b421c8ec7d2fe
compiler:       gcc (Debian 14.2.0-19) 14.2.0, GNU ld (GNU Binutils for Debian) 2.44
patch:          https://syzkaller.appspot.com/x/patch.diff?x=134b662d580000

Note: testing is done by a robot and is best-effort only.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-01  8:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-01  5:32 [syzbot] [rdma?] WARNING in rdma_resolve_addr syzbot
2026-11-01  8:17 ` Forwarded: [PATCH] RDMA/cma: Don't warn when device removal races with rdma_resolve_addr() syzbot
     [not found] <20261101081710.19095-1-kartikey406@gmail.com>
2026-11-01  8:52 ` [syzbot] [rdma?] WARNING in rdma_resolve_addr syzbot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®