mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
During the boot, the ZDEV_SITE_ID is derived with the help of loadparm and will be saved in ZDEV_SITE_ID_FILE, which will be the used by the udev-rules. ZDEV_SITE_ID_FILE creation can have a surface of symlink attack as we are directly using the fopen and fprintf on it. To avoid this, make sure that we are writing the ZDEV_SITE_ID to a temporary file, which will then be renamed to ZDEV_SITE_ID_FILE, which will remove all the existing symlinks associated with the target file. Reported-by: Marc Hartmayer <mhartmay@linux.ibm.com> Signed-off-by: Vineeth Vijayan <vneethv@linux.ibm.com> Reviewed-by: Peter Oberparleiter <oberpar@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>