]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commitdiff
drbd: fix null-pointer dereference on local read error
authorChristoph Böhmwalder <christoph.boehmwalder@linbit.com>
Fri, 20 Feb 2026 11:39:37 +0000 (12:39 +0100)
committerJens Axboe <axboe@kernel.dk>
Fri, 20 Feb 2026 14:09:06 +0000 (07:09 -0700)
In drbd_request_endio(), READ_COMPLETED_WITH_ERROR is passed to
__req_mod() with a NULL peer_device:

  __req_mod(req, what, NULL, &m);

The READ_COMPLETED_WITH_ERROR handler then unconditionally passes this
NULL peer_device to drbd_set_out_of_sync(), which dereferences it,
causing a null-pointer dereference.

Fix this by obtaining the peer_device via first_peer_device(device),
matching how drbd_req_destroy() handles the same situation.

Cc: stable@vger.kernel.org
Reported-by: Tuo Li <islituo@gmail.com>
Link: https://lore.kernel.org/linux-block/20260104165355.151864-1-islituo@gmail.com
Signed-off-by: Christoph Böhmwalder <christoph.boehmwalder@linbit.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/drbd/drbd_req.c

index d15826f6ee81d48e3fee05ee873c566f9e4d90b4..70f75ef079457d718c97620e695ed29e2c47bd0d 100644 (file)
@@ -621,7 +621,8 @@ int __req_mod(struct drbd_request *req, enum drbd_req_event what,
                break;
 
        case READ_COMPLETED_WITH_ERROR:
-               drbd_set_out_of_sync(peer_device, req->i.sector, req->i.size);
+               drbd_set_out_of_sync(first_peer_device(device),
+                               req->i.sector, req->i.size);
                drbd_report_io_error(device, req);
                __drbd_chk_io_error(device, DRBD_READ_ERROR);
                fallthrough;