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
counting partitions enumerated by the kernel.

This complement the previous fixes 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 a5edbb7
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/shared/dissect-image.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,21 @@ 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 *sysname;

/* Filter out MMC RPMB and Boot partitions, as they are not listed by blkid.
* 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 a5edbb7

Please sign in to comment.