Hello,

I am reporting a NULL-pointer dereference in blk_update_request() on a
successful REQ_INTEGRITY read. The request flag is set by dm-crypt
"integrity:<bytes>:none" and the request completes on a loop queue that
never registered an integrity profile.

Summary
=======

On 6.6, blk_update_request() does:

  if (blk_integrity_rq(req) && req_op(req) == REQ_OP_READ &&
      error == BLK_STS_OK)
          req->q->integrity.profile->complete_fn(req, nr_bytes);

blk_integrity_rq() tests only rq->cmd_flags & REQ_INTEGRITY. The same
unguarded call is in blk_complete_request().

dm-crypt "integrity:16:none" sets on_disk_tag_size. crypt_integrity_ctr(),
which requires an underlying DM-DIF-EXT-TAG profile, runs only for AEAD
or an integrity IV, so "none" loads on a plain loop device. On a read,
kcryptd_io_read() clones the bio onto that loop device and
dm_crypt_integrity_io_alloc() calls bio_integrity_alloc(), which sets
REQ_INTEGRITY. Loop never calls blk_integrity_register(), so
q->integrity.profile is NULL and the completion faults at offset 0x18.

Affected
========

Same PoC (loop + dm-crypt integrity:16:none + read), KASAN, 2026-11-30:

- Crashes: 6.6.163, 6.1.193, 5.15.226, 5.10.275
  (RIP in blk_update_request, KASAN range [0x18-0x1f], profile pointer 0)
- Does not crash: 7.4-rc5, 6.18.65, 6.12.119
  (crypt table loads, 32 reads return, no oops)
- First seen on 6.6.144 (campaign crash 
7b701911f170e96193541cff13ccd4729c7fc5b6)
- v6.11 removed struct blk_integrity_profile
  (e9f5f44ad372 "block: remove the blk_integrity_profile structure").
  On 6.12 and later, integrity:N:none also leaves tuple_size at 0, so
  the read is not tagged REQ_INTEGRITY.
- Files: block/blk-mq.c, drivers/md/dm-crypt.c
- Config: CONFIG_BLK_DEV_INTEGRITY=y, CONFIG_DM_CRYPT=y, CONFIG_BLK_DEV_LOOP=y
- Needs CAP_SYS_ADMIN

Crash excerpt (packaged PoC, Linux 6.6.163 #1, ksoftirqd)
==========================================================

KASAN: null-ptr-deref in range [0x0000000000000018-0x000000000000001f]
CPU: 1 PID: 21 Comm: ksoftirqd/1 Not tainted 6.6.163 #1
RIP: 0010:blk_update_request+0xa5d/0x1190
Call Trace:
 <TASK>
  blk_mq_end_request
  blk_complete_reqs
  handle_softirqs
  run_ksoftirqd
 </TASK>

A self-contained reproducer creates a loop device, loads one dm-crypt
table ("aes-cbc-plain … integrity:16:none") over it, and preads the
mapped device. I can send the Docker/QEMU package or test a patch.

Thanks,
Yu Junzhe
FuzzAnything <[email protected]>

Reply via email to