]> git.ipfire.org Git - thirdparty/libvirt.git/commit
virDevMapperGetTargetsImpl: quit early if device is not a devmapper target
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 24 Apr 2020 11:17:51 +0000 (13:17 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 11 May 2020 13:37:27 +0000 (15:37 +0200)
commit01626c668ecfbe465d18799ac4628e6127ea1d47
tree6e30db9b725e80ac241036752e3a182679892c86
parent673cde43d41f80ff5ebda2d35efa94c15556aed1
virDevMapperGetTargetsImpl: quit early if device is not a devmapper target

As suggested in the linked bug, libvirt should firstly check
whether the major number of the device is device mapper major.
Because if it isn't subsequent DM_DEVICE_DEPS task may not only
fail, but also yield different results. In the bugzilla this is
demonstrated by creating a devmapper target named 'loop0' and
then creating loop target /dev/loop0. When the latter is then
passed to a domain, our virDevMapperGetTargetsImpl() function
blindly asks devmapper to provide target dependencies for
/dev/loop0 and because of the way devmapper APIs work, it will
'sanitize' the input by using the last component only which is
'loop0' and thus return different results than expected.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1823976
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/util/virdevmapper.c