On Tue, Apr 22, 2025 at 18:51:18 +0800, jungleman759 wrote:
> Hi
> Thanks for following up, and sorry for the delay in getting back to you.
> You're right to suspect the issue might be related to device changes. Here’s 
> how the crash can be triggered:
> The VM initially uses a SATA controller, with a disk defined as:
> xml
> 复制编辑
> <controller type="scsi" index="0" model="lsilogic"></controller> <disk 
> type='file' device='disk'> <driver name='qemu' type='qcow2'/> <source 
> file='/var/lib/libvirt/images/Testguest.qcow2'/> <target dev='sda' 
> bus='sata'/> </disk> 
> A snapshot is created at this point — which records the disk as sda.
> Later, the VM is reconfigured to use a virtio controller, and the disk is now 
> assigned as vda.
> When the VM is running and the snapshot is deleted, the snapshot code still 
> expects to find a disk named sda in the current VM definition.
> Because of this mismatch, qemuDomainDiskByName() returns NULL, and the crash 
> occurs when the result is used without a null check.
> This can easily happen during controller or disk bus reconfiguration between 
> snapshot and deletion. The patch adds sanity checks to ensure we don’t 
> dereference a null pointer in this situation.
> Let me know if you’d like me to adjust the wording in the error messages or 
> add a reproducer for automated testing.

I think the error messages are good. They rely the fact that the disk
was not found. How that happened is not as important.

Reply via email to