]> 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>
Tue, 12 Jul 2016 11:34:54 +0000 (13:34 +0200)
commit50d1594c2e6142a3b51d2143c74027480df082e0
tree9c3f74f18a4e425370a531ddab2045f845fa1dd5
parent6f27e449a9cbb96c4731207469aea7cbd8d0a5c4
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