From 7225f2e5866b53300375c84b126d9a45967021b6 Mon Sep 17 00:00:00 2001 From: Matt Ezell Date: Wed, 17 Aug 2016 11:00:18 -0400 Subject: [PATCH] Protect umount_chroot from running with rootimage_dir undefined --- xCAT-server/share/xcat/netboot/rh/genimage | 6 +++++- xCAT-server/share/xcat/netboot/ubuntu/genimage | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/xCAT-server/share/xcat/netboot/rh/genimage b/xCAT-server/share/xcat/netboot/rh/genimage index a56e157b6..95f95351c 100755 --- a/xCAT-server/share/xcat/netboot/rh/genimage +++ b/xCAT-server/share/xcat/netboot/rh/genimage @@ -70,7 +70,7 @@ my $noupdate; sub xdie { system("rm -rf /tmp/xcatinitrd.$$"); - umount_chroot($rootimage_dir); + umount_chroot($rootimg_dir); die @_; } @@ -112,6 +112,10 @@ sub mount_chroot { sub umount_chroot { my $rootimage_dir = shift; + if ($rootimage_dir eq "") { + print "\n\n\n\nWARNING: /proc and /sys may still be mounted in the rootimgdir\n\n\n\n"; + return 1; + } if (majversion($osver) > 6) { system("umount -l $rootimage_dir/proc"); diff --git a/xCAT-server/share/xcat/netboot/ubuntu/genimage b/xCAT-server/share/xcat/netboot/ubuntu/genimage index e2ba372f0..112f4a0f8 100755 --- a/xCAT-server/share/xcat/netboot/ubuntu/genimage +++ b/xCAT-server/share/xcat/netboot/ubuntu/genimage @@ -2094,6 +2094,11 @@ sub mount_chroot { sub umount_chroot { my $rootimage_dir = shift; + if ($rootimage_dir eq "") { + print "\n\n\n\nWARNING: /proc and /sys may still be mounted in the rootimgdir\n\n\n\n"; + return 1; + } + system("umount -l $rootimage_dir/proc"); system("umount -l $rootimage_dir/sys");