diff --git a/microcode_ctl.spec b/microcode_ctl.spec index b77b794..6dcfb00 100644 --- a/microcode_ctl.spec +++ b/microcode_ctl.spec @@ -13,7 +13,7 @@ Summary: CPU microcode updates for Intel x86 processors Name: microcode_ctl Version: %{intel_ucode_version} -Release: 1%{?dist} +Release: 2%{?dist} Epoch: 4 License: CC0 and Redistributable, no modification permitted URL: https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files @@ -544,6 +544,9 @@ rm -rf %{buildroot} %changelog +* Tue Jun 06 2023 Eugene Syromiatnikov - 4:20230214-2 +- Cleanup the dangling symlinks in update_ucode (#2135376). + * Wed Feb 15 2023 Eugene Syromiatnikov - 4:20230214-1 - Update Intel CPU microcode to microcode-20230214 release, addresses CVE-2022-21216, CVE-2022-33196, CVE-2022-33972, CVE-2022-38090 (#2171234, diff --git a/update_ucode b/update_ucode index 0d5038e..57705e0 100644 --- a/update_ucode +++ b/update_ucode @@ -151,6 +151,17 @@ while :; do $cmd rm -f $verbose_opt "$name" done [ "xlist" = "x$action" ] || { + # Removing possible dangling symlinks + find "${FW_DIR}/${INTEL_UCODE_DIR}" \ + -maxdepth 1 -mindepth 1 \ + -type l -printf '%p\n' \ + | while read -r fname; do + [ -e "$fname" ] || { + debug " Removing danging symlink \"$fname\"" + $cmd rm -f $verbose_opt "$fname" + } + done + $cmd rmdir -p $verbose_opt \ "${FW_DIR}/${INTEL_UCODE_DIR}" 2>/dev/null \ || true @@ -225,6 +236,7 @@ fi | while read -r i; do fi done + if [ -e "$FW_DIR/$k/readme-$i" ]; then if [ "xlist" = "x$action" ]; then echo "$FW_DIR/$k/readme-$i" @@ -288,3 +300,17 @@ fi | while read -r i; do esac done done + +# Removing possible dangling symlinks in kernel-specific directories +debug "Checking for dangling symlinks..." +for k in $(echo "$kernel"); do + debug " Processing kernel version \"$k\"" + find "${FW_DIR}/${k}" \ + -mindepth 1 -type l -printf '%p\n' \ + | while read -r fname; do + [ -e "$fname" ] || { + debug " Removing danging symlink \"$fname\"" + $cmd rm -f $verbose_opt "$fname" + } + done +done