Skip to content

Commit

Permalink
dissect: Don't count RPMB and boot partitions
Browse files Browse the repository at this point in the history
Filter-out RPMB partitions and boot partitions from MMC devices when
comparing the size of the kernel and blkid partition lists.

This complement the previous fix to the problem reported in
systemd/systemd#5806

https://phabricator.endlessm.com/T21744
  • Loading branch information
jprvita committed Mar 29, 2018
1 parent f08ebe1 commit 0efe40e
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/shared/dissect-image.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,22 @@ int dissect_image(int fd, const void *root_hash, size_t root_hash_size, DissectI
/* Count the partitions enumerated by the kernel */
n = 0;
first = udev_enumerate_get_list_entry(e);
udev_list_entry_foreach(item, first)
udev_list_entry_foreach(item, first) {
_cleanup_udev_device_unref_ struct udev_device *q;
const char *node, *sysname;

/* Filter out weird MMC RPMB partitions, which cannot reasonably be read, see
* https://github.com/systemd/systemd/issues/5806 */
q = udev_device_new_from_syspath(udev, udev_list_entry_get_name(item));
if (!q)
return -errno;
sysname = udev_device_get_sysname(q);
if (sysname && startswith(sysname, "mmcblk") &&
(endswith(sysname, "rpmb") || endswith(sysname, "boot0" ) || endswith(sysname, "boot1")))
continue;

n++;
}

/* Count the partitions enumerated by blkid */
z = blkid_partlist_numof_partitions(pl);
Expand Down

0 comments on commit 0efe40e

Please sign in to comment.