[lvc-project] [PATCH] drbd: Fix potential NULL pointer dereference in _drbd_set_state()

Fedor Pchelkin pchelkin at ispras.ru
Fri Jul 10 17:16:42 MSK 2026


On Fri, 10. Jul 13:13, Christoph Böhmwalder wrote:
> Can the list actually be empty at this point?
> The peer_device is linked into the list in drbd_create_device(), before
> add_disk() and before the device is inserted into connection->peer_devices,
> so no state change can reach the device earlier.
> 
> It is only unlinked again in drbd_destroy_device(), after the last kref
> to the device is gone.
> The connection itself is created together with the resource in
> drbd_adm_new_resource() and lives until the resource is destroyed.
> 
> So for any device this function can be called on, first_peer_device()
> returns a valid peer_device.

Уберём патч из кандидатов на релиз lvc-веток, в итоговые релизы он ещё
не попадал, хоть и вреда от него нет, если условие недостижимое.

Просьба обновить состояние в свейсере.  Исходя из обоснования код,
присваивающий NULL в connection - недостижим.  Непонятки в коде при
работе с проверками/присваиваниями NULL => Confirmed Minor.



More information about the lvc-project mailing list