CVE-2026-74372: raid1: fix nr_pending leak in REQ_ATOMIC bad-block error path
In the Linux kernel, the following vulnerability has been resolved:
raid1: fix nrpending leak in REQATOMIC bad-block error path
In raid1writerequest(), each per-mirror loop iteration begins by incrementing rdev->nrpending. If a REQATOMIC write encounters a badblock within the requested range, the code jumps to errhandle without dropping the reference taken for the current mirror.
errhandle's cleanup loop will only decrements for k < i and r1bio->bios[k] is non-NULL. The current slot is therefore skipped, leaving its nrpending reference leaked permanently. The reference prevents the rdev from ever being removed, since raid1removeconf() refuses to remove an rdev with nrpending > 0.
Fix this by calling rdevdecpending() before jumping to errhandle.
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Configuration
In raid1_write_request() (raid1_write_request(), per-mirror loop), if a REQ_ATOMIC write encounters badblock within the requested range and the code jumps to err_handle, call rdev_dec_pending() for the current mirror slot before transferring control to err_handle. This prevents leaking the increment to rdev->nr_pending for the current mirror (nr_pending leak in REQ_ATOMIC bad-block error path).
Linux kernel (raid1) call rdev_dec_pending() before jumping to err_handle in raid1_write_request() = add call in REQ_ATOMIC bad-block error path