Blame 0001-dracut.sh-harden-host_modalias-reading.patch

Harald Hoyer d559f4
From 57f90974f9d7c11e06c2b3f2b7e4b47801f380cc Mon Sep 17 00:00:00 2001
Harald Hoyer d559f4
From: Harald Hoyer <harald@redhat.com>
Harald Hoyer d559f4
Date: Fri, 13 Sep 2013 16:33:01 +0200
Harald Hoyer d559f4
Subject: [PATCH] dracut.sh: harden host_modalias reading
Harald Hoyer d559f4
Harald Hoyer d559f4
Some weird PPC driver make their modulias unreadable
Harald Hoyer d559f4
Harald Hoyer d559f4
$ cat /sys/devices/vio/4000/modalias
Harald Hoyer d559f4
cat: /sys/devices/vio/4000/modalias: No such device
Harald Hoyer d559f4
---
Harald Hoyer d559f4
 dracut.sh | 2 +-
Harald Hoyer d559f4
 1 file changed, 1 insertion(+), 1 deletion(-)
Harald Hoyer d559f4
Harald Hoyer d559f4
diff --git a/dracut.sh b/dracut.sh
Harald Hoyer d559f4
index bd905e3..fd27846 100755
Harald Hoyer d559f4
--- a/dracut.sh
Harald Hoyer d559f4
+++ b/dracut.sh
Harald Hoyer d559f4
@@ -921,7 +921,7 @@ if [[ $hostonly ]]; then
Harald Hoyer d559f4
     declare -A host_modalias
Harald Hoyer d559f4
     find  /sys/devices/ -name modalias -print > "$initdir/.modalias"
Harald Hoyer d559f4
     while read m; do
Harald Hoyer d559f4
-        host_modalias["$(<"$m")"]=1
Harald Hoyer d559f4
+        modalias="$(<"$m")" && [[ $modalias ]] && host_modalias["$modalias"]=1
Harald Hoyer d559f4
     done < "$initdir/.modalias"
Harald Hoyer d559f4
     rm -f -- "$initdir/.modalias"
Harald Hoyer d559f4