[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#848906: trying to raise attention to this bug with a patch



package initramfs-tools-core
severity 848906 important
thanks

The patch against 0.126 (still valid against 0.127) modifying
/usr/share/initramfs-tools/scripts/local follows.
--- /usr/share/initramfs-tools/scripts/local	2016-04-17 21:39:22.000000000 +0200
+++ /usr/share/initramfs-tools/scripts/local.new	2016-12-18 17:05:13.419988203 +0100
@@ -55,10 +55,15 @@
 		modprobe ubi mtd=$UBIMTD
 		DEV="${dev_id}"
 		return
 	fi
 
+	# Detect (some) invalid device names
+	if [ -z "${dev_id}" ]; then
+		panic "Empty root device name deteted. Try passing root= bootarg."
+	fi
+
 	# Don't wait for a device that doesn't have a corresponding
 	# device in /dev and isn't resolvable by blkid (e.g. mtd0)
 	if [ "${dev_id#/dev}" = "${dev_id}" ] &&
 	   [ "${dev_id#*=}" = "${dev_id}" ]; then
 		DEV="${dev_id}"
@@ -136,17 +141,20 @@
 	# FIXME This has no error checking
 	modprobe ${FSTYPE}
 
 	checkfs ${ROOT} root "${FSTYPE}"
 
-	# FIXME This has no error checking
 	# Mount root
 	if [ "${FSTYPE}" != "unknown" ]; then
 		mount ${roflag} -t ${FSTYPE} ${ROOTFLAGS} ${ROOT} ${rootmnt}
 	else
 		mount ${roflag} ${ROOTFLAGS} ${ROOT} ${rootmnt}
 	fi
+	# Basic error checking
+	if [ $? != 0 ] || { command -v mountpoint >/dev/null 2>&1 && ! mountpoint ${rootmnt}; }; then
+		panic "ALERT! The root fs failed to be mounted. Dropping to a shell."
+	fi
 }
 
 local_mount_fs()
 {
 	read_fstab_entry "$1"
@@ -167,13 +175,16 @@
 
 	if [ "$MNT_PASS" != 0 ]; then
 		checkfs "$MNT_FSNAME" "$MNT_DIR" "${MNT_TYPE}"
 	fi
 
-	# FIXME This has no error checking
 	# Mount filesystem
 	mount ${roflag} -t "${MNT_TYPE}" -o "${MNT_OPTS}" "$MNT_FSNAME" "${rootmnt}${MNT_DIR}"
+	# Basic error checking
+	if [ $? != 0 ] || { command -v mountpoint >/dev/null 2>&1 && ! mountpoint ${rootmnt}; }; then
+		panic "ALERT! The '${MNT_DIR}' fs failed to be mounted. Dropping to a shell."
+	fi
 }
 
 mountroot()
 {
 	local_mount_root

Reply to: