[bug report] Potential atomicity bug in drivers/target/sbp/sbp_target.c, between tgt_agent_fetch_work() and tgt_agent_rw_orb_pointer()
Ginger <[email protected]> Mon, 1 Jun 2026 12:33:07 +0800
| Newsgroups | org.kernel.vger.target-devel |
|---|---|
| Message-ID | <CAGp+u1a-=aJxSfa3k0mfLd0LrbyVgfDh=_BLQNc2dfamv3nAsg@mail.gmail.com> |
Dear Linux kernel maintainers,
My research-based static analyzer found a potential atomicity bug
within the 'drivers/target/sbp' subsystem, more specifically, in
'drivers/target/sbp/sbp_target.c'.
This potential issue is present as of git commit
eb3f4b7426cfd2b79d65b7d37155480b32259a11 of the mainline kernel.
Potential concurrent triggering executions:
T0:
tgt_agent_fetch_work
--> spin_lock_bh(&agent->lock);
--> agent->doorbell = false;
--> agent->orb_pointer = next_orb;
--> spin_unlock_bh(&agent->lock)
T1:
tgt_agent_rw_orb_pointer
--> spin_unlock_bh(&agent->lock);
--> agent->orb_pointer = sbp2_pointer_to_addr(ptr);
--> agent->doorbell = false;
The writes to 'agent->orb_pointer' and 'agent->doorbell' are outside
of the critical section of 'agent->lock'.
This does align with the lock's critical section in T0 as
'agent->lock' seems to be responsible for 'agent->orb_pointer'.
Please kindly check at your convenience. Thank you for your time and
consideration.
Best regards,
Ginger