OSDN Git Service

init: skip to mount unknown type partitions
authorChih-Wei Huang <cwhuang@linux.org.tw>
Fri, 6 Oct 2017 10:04:20 +0000 (18:04 +0800)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Thu, 26 Oct 2017 06:54:14 +0000 (14:54 +0800)
Trying to mount an unknown type partition may cause kernel panic.

initrd/init

index 6a30441..fdcea52 100755 (executable)
@@ -3,7 +3,7 @@
 # By Chih-Wei Huang <cwhuang@linux.org.tw>
 # and Thorsten Glaser <tg@mirbsd.org>
 #
-# Last updated 2017/07/17
+# Last updated 2017/10/06
 #
 # License: GNU Public License
 # We explicitely grant the right to use the scripts
@@ -75,6 +75,7 @@ check_root()
                blk=`basename $1`
                [ ! -e /dev/block/$blk ] && ln $1 /dev/block
                dev=/dev/block/$blk
+               blkid $dev | grep -q TYPE || return 1
        else
                dev=$1
        fi