Skip to content

ublk: fix null-ptr-deref in ublk_queue_cmd#917

Open
blktests-ci[bot] wants to merge 1 commit into
linus-master_basefrom
series/1104193=>linus-master
Open

ublk: fix null-ptr-deref in ublk_queue_cmd#917
blktests-ci[bot] wants to merge 1 commit into
linus-master_basefrom
series/1104193=>linus-master

Conversation

@blktests-ci

@blktests-ci blktests-ci Bot commented Jun 1, 2026

Copy link
Copy Markdown

Pull request for series with
subject: ublk: fix null-ptr-deref in ublk_queue_cmd
version: 1
url: https://patchwork.kernel.org/project/linux-block/list/?series=1104193

@blktests-ci

blktests-ci Bot commented Jun 1, 2026

Copy link
Copy Markdown
Author

Upstream branch: e43ffb6
series: https://patchwork.kernel.org/project/linux-block/list/?series=1104193
version: 1

@blktests-ci

blktests-ci Bot commented Jun 3, 2026

Copy link
Copy Markdown
Author

Upstream branch: ba3e43a
series: https://patchwork.kernel.org/project/linux-block/list/?series=1104193
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/1104193=>linus-master branch from f266c19 to f2d87d4 Compare June 3, 2026 14:14
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from fc36596 to 7bed9c3 Compare June 5, 2026 09:48
@blktests-ci

blktests-ci Bot commented Jun 5, 2026

Copy link
Copy Markdown
Author

Upstream branch: ddd664b
series: https://patchwork.kernel.org/project/linux-block/list/?series=1104193
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/1104193=>linus-master branch from f2d87d4 to 07251c7 Compare June 5, 2026 10:02
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from 7bed9c3 to a7bb5c5 Compare June 7, 2026 14:54
@blktests-ci

blktests-ci Bot commented Jun 7, 2026

Copy link
Copy Markdown
Author

Upstream branch: 979c294
series: https://patchwork.kernel.org/project/linux-block/list/?series=1104193
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/1104193=>linus-master branch from 07251c7 to 48b4d93 Compare June 7, 2026 15:07
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from a7bb5c5 to 5e41a3b Compare June 10, 2026 13:31
@blktests-ci

blktests-ci Bot commented Jun 10, 2026

Copy link
Copy Markdown
Author

Upstream branch: acb7500
series: https://patchwork.kernel.org/project/linux-block/list/?series=1104193
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/1104193=>linus-master branch from 48b4d93 to 24308c5 Compare June 10, 2026 14:02
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from 5e41a3b to c3a084b Compare June 10, 2026 20:26
@blktests-ci

blktests-ci Bot commented Jun 11, 2026

Copy link
Copy Markdown
Author

Upstream branch: 9716c08
series: https://patchwork.kernel.org/project/linux-block/list/?series=1104193
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/1104193=>linus-master branch from 24308c5 to f1a0a92 Compare June 11, 2026 09:34
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from c3a084b to 5f78e5d Compare June 12, 2026 22:27
@blktests-ci

blktests-ci Bot commented Jun 12, 2026

Copy link
Copy Markdown
Author

Upstream branch: 2a2974b
series: https://patchwork.kernel.org/project/linux-block/list/?series=1104193
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/1104193=>linus-master branch from f1a0a92 to 8b0e958 Compare June 12, 2026 23:00
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from 5f78e5d to e48f9db Compare June 13, 2026 01:19
@blktests-ci

blktests-ci Bot commented Jun 13, 2026

Copy link
Copy Markdown
Author

Upstream branch: 062871f
series: https://patchwork.kernel.org/project/linux-block/list/?series=1104193
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/1104193=>linus-master branch from 8b0e958 to eedaf12 Compare June 13, 2026 01:57
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch 2 times, most recently from 199644a to e6d9eb8 Compare June 17, 2026 12:02
@blktests-ci

blktests-ci Bot commented Jun 17, 2026

Copy link
Copy Markdown
Author

Upstream branch: 66affa3
series: https://patchwork.kernel.org/project/linux-block/list/?series=1104193
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/1104193=>linus-master branch from eedaf12 to 7151b53 Compare June 17, 2026 13:54
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from e6d9eb8 to 7d8604f Compare June 24, 2026 01:11
ublk_queue_cmd() dereferences ios[tag].cmd without NULL check. The cmd
pointer can be NULL when ublk_cancel_cmd() races with IO dispatch during
server teardown:

  CPU0 (partition scan work)        CPU1 (io_uring cancel callback)
  ublk_queue_rq()
    ublk_prep_req() -> OK
    check canceling -> false
                                    ublk_start_cancel()
                                      quiesce, set canceling, unquiesce
                                    ublk_cancel_cmd()
                                      io->cmd = NULL
    ublk_queue_cmd()
      cmd = ios[tag].cmd  -> NULL
      ublk_get_uring_cmd_pdu(cmd) -> null-ptr-deref

The race window exists because ublk_cancel_cmd() can execute between the
canceling flag check and the cmd dereference in ublk_queue_cmd(). This
cannot be closed with simple synchronization since blk_mq_quiesce_queue
only waits for in-flight dispatches, not requests already past the
canceling check.

Fix by checking cmd for NULL before dereferencing. When NULL, abort the
request via __ublk_abort_rq() which handles both recovery (requeue) and
non-recovery (end with IOERR) cases.

Fixes: 71f28f3 ("ublk_drv: add io_uring based userspace block driver")
Reported-by: syzbot+415b9ec753cd2a196087@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=415b9ec753cd2a196087
Signed-off-by: Yun Zhou <yun.zhou@windriver.com>
@blktests-ci

blktests-ci Bot commented Jun 24, 2026

Copy link
Copy Markdown
Author

Upstream branch: bade58e
series: https://patchwork.kernel.org/project/linux-block/list/?series=1104193
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/1104193=>linus-master branch from 7151b53 to 2cb8d67 Compare June 24, 2026 01:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant