]> git.ipfire.org Git - thirdparty/util-linux.git/commit
libblkid: avoid non-empty recursion in EBR
authorKarel Zak <kzak@redhat.com>
Tue, 12 Jul 2016 11:34:54 +0000 (13:34 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 10 Aug 2016 11:06:23 +0000 (13:06 +0200)
commit234976de506061d6c0388ca9018b9c2d7928b18b
tree573aac3aa259784158d662c93c25ab0a297e3137
parent3005a5b8968bda9a2c3f2a161e2e39114498807d
libblkid: avoid non-empty recursion in EBR

This is extension to the patch 7164a1c34d18831ac61c6744ad14ce916d389b3f.

We also need to detect non-empty recursion in the EBR chain. It's
possible to create standard valid logical partitions and in the last one
points back to the EBR chain. In this case all offsets will be non-empty.

Unfortunately, it's valid to create logical partitions that are not in
the "disk order" (sorted by start offset). So link somewhere back is
valid, but this link cannot points to already existing partition
(otherwise we will see recursion).

This patch forces libblkid to ignore duplicate logical partitions, the
duplicate chain segment is interpreted as non-data segment, after 100
iterations with non-data segments it will break the loop -- no memory
is allocated in this case by the loop.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1349536
References: http://seclists.org/oss-sec/2016/q3/40
Signed-off-by: Karel Zak <kzak@redhat.com>
libblkid/src/partitions/dos.c
libblkid/src/partitions/partitions.c
libblkid/src/partitions/partitions.h