Add a patch to fix eMMC sysfs path parsing

Resolves: rhbz#1826864
This commit is contained in:
Hans de Goede 2020-04-22 20:15:40 +02:00
parent 16595f2beb
commit 9a21dabf72
2 changed files with 64 additions and 1 deletions

View File

@ -0,0 +1,55 @@
From 54dad567c41b57c4843329856ca5047e63325a9f Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Wed, 22 Apr 2020 19:33:01 +0200
Subject: [PATCH] Fix /sys/block sysfs parsing for eMMC-s
Commit 471869409464 ("sysfs parsers: make all the /sys/block link
parsers work the same way") has broken sysfs parsing for eMMC-s when
the passed in path points to the whole block device.
In that case pos2 will stay at its -1 initializaton value, because we
only do 4 conversions; and when we then do:
current += pos2
We end up moving current one char position backwards and we end up
returning -1.
The correct positing to use is always pos1 independent if we got
passed the whole disk; or a parition, as we always want to return
only the part which points to whole disk which ends at pos1.
Note that it seems that before commit 471869409464, the case where
path points to the partition was likely broken as the old code then
would return the entire path including the partition element.
BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1826864
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
src/linux-emmc.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/src/linux-emmc.c b/src/linux-emmc.c
index 800dc14..65557b4 100644
--- a/src/linux-emmc.c
+++ b/src/linux-emmc.c
@@ -56,13 +56,10 @@ parse_emmc(struct device *dev, const char *path, const char *root UNUSED)
dev->emmc_info.slot_id = slot_id;
dev->interface_type = emmc;
- if (rc == 6) {
- if (dev->part == -1)
- dev->part = partition;
+ if (rc == 6 && dev->part == -1)
+ dev->part = partition;
- pos2 = pos1;
- }
- current += pos2;
+ current += pos1;
debug("current:'%s' sz:%zd", current, current - path);
return current - path;
--
2.26.0

View File

@ -1,6 +1,6 @@
Name: efivar Name: efivar
Version: 37 Version: 37
Release: 7%{?dist} Release: 8%{?dist}
Summary: Tools to manage UEFI variables Summary: Tools to manage UEFI variables
License: LGPLv2.1 License: LGPLv2.1
URL: https://github.com/rhboot/efivar URL: https://github.com/rhboot/efivar
@ -16,6 +16,10 @@ Source1: efivar.patches
%include %{SOURCE1} %include %{SOURCE1}
# Source1 patches reflect a git snapshot, this is a separate fix on top
# with a gap in between
Patch100: 0001-Fix-sys-block-sysfs-parsing-for-eMMC-s.patch
%description %description
efivar provides a simple command line interface to the UEFI variable facility. efivar provides a simple command line interface to the UEFI variable facility.
@ -75,6 +79,10 @@ make abicheck
%{_libdir}/*.so.* %{_libdir}/*.so.*
%changelog %changelog
* Wed Apr 22 2020 Hans de Goede <hdegoede@redhat.com> - 37-8
- Add a patch to fix eMMC sysfs path parsing
Resolves: rhbz#1826864
* Mon Feb 24 2020 Peter Jones <pjones@redhat.com> - 37-7 * Mon Feb 24 2020 Peter Jones <pjones@redhat.com> - 37-7
- Package our abignore file to try to shut taskotron up some. - Package our abignore file to try to shut taskotron up some.