]> git.ipfire.org Git - thirdparty/util-linux.git/commit
libblkid: fix file descriptor leak in blkid_verify()
authorKarel Zak <kzak@redhat.com>
Wed, 31 Jul 2019 14:18:27 +0000 (16:18 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 31 Jul 2019 14:31:10 +0000 (16:31 +0200)
commitc4d6d1c54dcd0eff701236d396d88b1fc6251768
treef69ae05887909c69fedb2fa847e5ef221e886374
parentefee3e01bf64e45a764b2af98e578deb20578f6b
libblkid: fix file descriptor leak in blkid_verify()

The function blkid_verify() uses private device file descriptor and
uses blkid_probe_set_device() to assign the descriptor to low-level
probing code. Unfortunately, close() in this case is not enough as the
prober can internally open whole-disk device too.

The library API has been extended so blkid_probe_set_device()
deallocates and close previously used prober for whole-disk. This new
functionality is used in blkid_verify() now.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1734545
Signed-off-by: Karel Zak <kzak@redhat.com>
libblkid/src/probe.c
libblkid/src/verify.c