Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package grub2 for openSUSE:Factory checked in at 2025-03-18 17:37:33 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/grub2 (Old) and /work/SRC/openSUSE:Factory/.grub2.new.19136 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "grub2" Tue Mar 18 17:37:33 2025 rev:353 rq:1254015 version:2.12 Changes: -------- --- /work/SRC/openSUSE:Factory/grub2/grub2.changes 2025-03-15 16:16:19.868689454 +0100 +++ /work/SRC/openSUSE:Factory/.grub2.new.19136/grub2.changes 2025-03-18 17:37:44.124581975 +0100 @@ -1,0 +2,14 @@ +Mon Mar 17 08:27:29 UTC 2025 - Michael Chang <mch...@suse.com> + +- Refresh PPC NVMEoF ofpath related patches to newer revision + * 0002-ieee1275-ofpath-enable-NVMeoF-logical-device-transla.patch +- Patch refreshed + * 0001-ieee1275-support-added-for-multiple-nvme-bootpaths.patch +- Patch obseleted + * 0004-ofpath-controller-name-update.patch + * 0001-squash-ieee1275-ofpath-enable-NVMeoF-logical-device-.patch +- Fix segmentation fault error in grub2-probe with target=hints_string + (bsc#1235971) (bsc#1235958) (bsc#1239651) + * 0001-ofpath-Add-error-check-in-NVMEoF-device-translation.patch + +------------------------------------------------------------------- Old: ---- 0001-squash-ieee1275-ofpath-enable-NVMeoF-logical-device-.patch 0004-ofpath-controller-name-update.patch New: ---- 0001-ofpath-Add-error-check-in-NVMEoF-device-translation.patch BETA DEBUG BEGIN: Old: * 0004-ofpath-controller-name-update.patch * 0001-squash-ieee1275-ofpath-enable-NVMeoF-logical-device-.patch - Fix segmentation fault error in grub2-probe with target=hints_string Old:- Patch obseleted * 0004-ofpath-controller-name-update.patch * 0001-squash-ieee1275-ofpath-enable-NVMeoF-logical-device-.patch BETA DEBUG END: BETA DEBUG BEGIN: New: (bsc#1235971) (bsc#1235958) (bsc#1239651) * 0001-ofpath-Add-error-check-in-NVMEoF-device-translation.patch BETA DEBUG END: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ grub2.spec ++++++ --- /var/tmp/diff_new_pack.WTtm8p/_old 2025-03-18 17:37:47.792735732 +0100 +++ /var/tmp/diff_new_pack.WTtm8p/_new 2025-03-18 17:37:47.796735900 +0100 @@ -353,7 +353,6 @@ Patch162: 0001-ieee1275-add-support-for-NVMeoFC.patch Patch163: 0002-ieee1275-ofpath-enable-NVMeoF-logical-device-transla.patch Patch164: 0003-ieee1275-change-the-logic-of-ieee1275_get_devargs.patch -Patch165: 0004-ofpath-controller-name-update.patch Patch166: 0002-Mark-environmet-blocks-as-used-for-image-embedding.patch Patch167: grub2-increase-crypttab-path-buffer.patch Patch170: 0001-tpm2_key_protector-Support-authorized-policy.patch @@ -382,7 +381,6 @@ Patch196: fix_no_extra_deps_in_release_tarball.patch Patch197: 0001-fs-xfs-always-verify-the-total-number-of-entries-is-.patch Patch198: 0001-loader-arm64-efi-linux-Remove-magic-number-header-fi.patch -Patch199: 0001-squash-ieee1275-ofpath-enable-NVMeoF-logical-device-.patch Patch200: 0001-ofdisk-enhance-boot-time-by-focusing-on-boot-disk-re.patch Patch201: 0002-ofdisk-add-early_log-support.patch Patch202: 0001-disk-Optimize-disk-iteration-by-moving-memdisk-to-th.patch @@ -446,6 +444,7 @@ Patch271: 0007-appendedsig-Reads-the-default-DB-keys-from-ELF-Note.patch Patch272: 0008-appendedsig-The-grub-command-s-trusted-and-distruste.patch Patch273: 0009-appendedsig-documentation.patch +Patch274: 0001-ofpath-Add-error-check-in-NVMEoF-device-translation.patch %if 0%{?suse_version} < 1600 Requires: gettext-runtime ++++++ 0001-ieee1275-support-added-for-multiple-nvme-bootpaths.patch ++++++ --- /var/tmp/diff_new_pack.WTtm8p/_old 2025-03-18 17:37:47.940741936 +0100 +++ /var/tmp/diff_new_pack.WTtm8p/_new 2025-03-18 17:37:47.944742103 +0100 @@ -15,11 +15,9 @@ include/grub/util/ofpath.h | 4 ++ 4 files changed, 74 insertions(+), 4 deletions(-) -diff --git a/grub-core/osdep/linux/ofpath.c b/grub-core/osdep/linux/ofpath.c -index 51d331f06..55ed7ddf2 100644 --- a/grub-core/osdep/linux/ofpath.c +++ b/grub-core/osdep/linux/ofpath.c -@@ -209,7 +209,7 @@ find_obppath (const char *sysfs_path_orig) +@@ -209,7 +209,7 @@ } } @@ -28,7 +26,7 @@ xrealpath (const char *in) { char *out; -@@ -224,7 +224,7 @@ xrealpath (const char *in) +@@ -224,7 +224,7 @@ return out; } @@ -37,17 +35,15 @@ block_device_get_sysfs_path_and_link(const char *devicenode) { char *rpath; -@@ -535,7 +535,7 @@ of_path_get_nvme_nsid(const char* devname) - +@@ -613,7 +613,7 @@ + return nsid; } -static char * +char * - nvme_get_syspath(const char *nvmedev) + nvme_get_syspath (const char *nvmedev) { char *sysfs_path, *controller_node; -diff --git a/grub-core/osdep/unix/platform.c b/grub-core/osdep/unix/platform.c -index 1e2961e00..bafcc84d7 100644 --- a/grub-core/osdep/unix/platform.c +++ b/grub-core/osdep/unix/platform.c @@ -28,6 +28,8 @@ @@ -59,7 +55,7 @@ static char * get_ofpathname (const char *dev) -@@ -203,6 +205,56 @@ grub_install_register_efi (const grub_disk_t *efidir_grub_disk, +@@ -203,6 +205,56 @@ return 0; } @@ -116,7 +112,7 @@ void grub_install_register_ieee1275 (int is_prep, const char *install_device, int partno, const char *relpath) -@@ -242,8 +294,19 @@ grub_install_register_ieee1275 (int is_prep, const char *install_device, +@@ -242,8 +294,19 @@ } *ptr = '\0'; } @@ -137,11 +133,9 @@ if (grub_util_exec ((const char * []){ "nvsetenv", "boot-device", boot_device, NULL })) -diff --git a/include/grub/util/install.h b/include/grub/util/install.h -index 563cf68e9..2fd102649 100644 --- a/include/grub/util/install.h +++ b/include/grub/util/install.h -@@ -241,6 +241,9 @@ grub_install_register_efi (const grub_disk_t *efidir_grub_disk, +@@ -241,6 +241,9 @@ const char *efi_distributor, const char *force_disk); @@ -151,21 +145,16 @@ void grub_install_register_ieee1275 (int is_prep, const char *install_device, int partno, const char *relpath); -diff --git a/include/grub/util/ofpath.h b/include/grub/util/ofpath.h -index a0ec30620..cc3c4bfbd 100644 --- a/include/grub/util/ofpath.h +++ b/include/grub/util/ofpath.h -@@ -31,5 +31,9 @@ void add_filename_to_pile(char *filename, struct ofpath_files_list_root* root); - void find_file(char* filename, char* directory, struct ofpath_files_list_root* root, int max_depth, int depth); - - char* of_find_fc_host(char* host_wwpn); +@@ -30,5 +30,9 @@ + void find_file (char* filename, char* directory, struct ofpath_files_list_root* root, int max_depth, int depth); + char* of_find_fc_host (char* host_wwpn); + void free_ofpath_files_list (struct ofpath_files_list_root* root); +char* nvme_get_syspath (const char *nvmedev); +char* block_device_get_sysfs_path_and_link (const char *devicenode); +char* xrealpath (const char *in); +unsigned int of_path_get_nvme_nsid (const char* devname); #endif /* ! GRUB_OFPATH_MACHINE_UTIL_HEADER */ --- -2.47.0 - ++++++ 0001-ofpath-Add-error-check-in-NVMEoF-device-translation.patch ++++++ >From 4b26a490def61786bfd5f66f0f68a33447dccb90 Mon Sep 17 00:00:00 2001 From: Michael Chang <mch...@suse.com> Date: Mon, 10 Feb 2025 18:20:28 +0800 Subject: [PATCH] ofpath: Add error check in NVMEoF device translation Signed-Off-by: Michael Chang <mch...@suse.com> --- grub-core/osdep/linux/ofpath.c | 95 ++++++++++++++++++++++++---------- 1 file changed, 69 insertions(+), 26 deletions(-) diff --git a/grub-core/osdep/linux/ofpath.c b/grub-core/osdep/linux/ofpath.c index 66a256b18b..4b920ddc20 100644 --- a/grub-core/osdep/linux/ofpath.c +++ b/grub-core/osdep/linux/ofpath.c @@ -536,52 +536,90 @@ of_path_get_nvmeof_adapter_info (char* sysfs_path, } snprintf (buf, 512, "%s/subsysnqn", sysfs_path); - fp = fopen (buf, "r"); - fscanf (fp, "%s", nvmeof_info->nqn); + if (! (fp = fopen (buf, "r")) || + fscanf (fp, "%s", nvmeof_info->nqn) != 1) + { + if (fp) + fclose (fp); + free (nvmeof_info->host_wwpn); + free (nvmeof_info->target_wwpn); + free (nvmeof_info->nqn); + free (buf); + return -1; + } fclose (fp); snprintf (buf, 512, "%s/cntlid", sysfs_path); - fp = fopen (buf, "r"); - fscanf (fp, "%u", &(nvmeof_info->cntlid)); + if (! (fp = fopen (buf, "r")) || + fscanf (fp, "%u", &(nvmeof_info->cntlid)) != 1) + { + if (fp) + fclose (fp); + free (nvmeof_info->host_wwpn); + free (nvmeof_info->target_wwpn); + free (nvmeof_info->nqn); + free (buf); + return -1; + } fclose (fp); snprintf (buf, 512, "%s/address", sysfs_path); - fp = fopen (buf, "r"); - buf2 = malloc (sizeof (char) * 512); - - if (!buf2) + buf2 = NULL; + fp = NULL; + if (! (buf2 = malloc (sizeof (char) * 512)) || + ! (fp = fopen (buf, "r")) || + fscanf (fp, "%s", buf2) != 1) { + if (fp) + fclose (fp); free (nvmeof_info->host_wwpn); free (nvmeof_info->target_wwpn); free (nvmeof_info->nqn); free (buf); + free (buf2); return -1; } - - fscanf (fp, "%s", buf2); fclose (fp); - buf3 = strrchr (buf2, '-') + 1; - grub_memcpy (nvmeof_info->host_wwpn, buf3, 256); - buf3=strchr (buf2, '-') + 1; - buf3=strchr (buf3, '-') + 1; - buf3=strchr (buf3, 'x') + 1; - grub_memcpy (nvmeof_info->target_wwpn, buf3, 256); + if (! (buf3 = strrchr (buf2, '-'))) + { + free (nvmeof_info->host_wwpn); + free (nvmeof_info->target_wwpn); + free (nvmeof_info->nqn); + free (buf); + free (buf2); + return -1; + } + grub_memcpy (nvmeof_info->host_wwpn, buf3 + 1, 256); + if (! (buf3 = strchr (buf2, '-')) || + ! (buf3 = strchr (buf3 + 1, '-')) || + ! (buf3 = strchr (buf3 + 1, 'x'))) + { + free (nvmeof_info->host_wwpn); + free (nvmeof_info->target_wwpn); + free (nvmeof_info->nqn); + free (buf); + free (buf2); + return -1; + } + grub_memcpy (nvmeof_info->target_wwpn, buf3 + 1, 256); buf3 = strchr (nvmeof_info->target_wwpn, ','); - *buf3 = '\0'; + if (buf3) + *buf3 = '\0'; free (buf); free (buf2); return 0; } -#define MAX_NVME_NSID_DIGITS 6 +#define OFPATH_MAX_UINT_HEX_DIGITS 8 +#define OFPATH_MAX_INT_DIGITS 10 static char * of_path_get_nvme_controller_name_node (const char* devname) { char *controller_node, *end; - controller_node = strdup (devname); + controller_node = xstrdup (devname); end = grub_strchr (controller_node + 1, 'n'); if (end != NULL) { @@ -616,15 +654,20 @@ of_path_get_nvme_nsid (const char* devname) char * nvme_get_syspath (const char *nvmedev) { - char *sysfs_path, *controller_node; + char *sysfs_path; sysfs_path = block_device_get_sysfs_path_and_link (nvmedev); if (strstr (sysfs_path, "nvme-subsystem")) { - controller_node = of_path_get_nvme_controller_name_node (nvmedev); - strcat (sysfs_path, "/"); - strcat (sysfs_path, controller_node); - sysfs_path = xrealpath (sysfs_path); + char *controller_node = of_path_get_nvme_controller_name_node (nvmedev); + char *buf = xmalloc (strlen (sysfs_path) + strlen ("/") + strlen (controller_node) + 1); + strcpy (buf, sysfs_path); + strcat (buf, "/"); + strcat (buf, controller_node); + free (sysfs_path); + free (controller_node); + sysfs_path = xrealpath (buf); + free (buf); } return sysfs_path; @@ -693,7 +736,7 @@ of_path_of_nvme(const char *sys_devname __attribute__((unused)), unsigned int nsid = of_path_get_nvme_nsid (nvmedev); if (nsid) { - snprintf (disk+chars_written, sizeof("/namespace@") + MAX_NVME_NSID_DIGITS, + snprintf (disk+chars_written, sizeof("/namespace@") + OFPATH_MAX_UINT_HEX_DIGITS + OFPATH_MAX_INT_DIGITS, "/namespace@%x:%d", nsid, part); } free (nvmeof_info); @@ -734,7 +777,7 @@ of_path_of_nvme(const char *sys_devname __attribute__((unused)), unsigned int nsid = of_path_get_nvme_nsid (device); if (nsid) { - snprintf (disk+chars_written,sizeof("/namespace@") + sizeof(char) * MAX_NVME_NSID_DIGITS, + snprintf (disk+chars_written,sizeof("/namespace@") + sizeof(char) * OFPATH_MAX_UINT_HEX_DIGITS, "/namespace@%x", nsid); } free (nvmeof_info); -- 2.48.1 ++++++ 0002-ieee1275-ofpath-enable-NVMeoF-logical-device-transla.patch ++++++ ++++ 690 lines (skipped) ++++ between /work/SRC/openSUSE:Factory/grub2/0002-ieee1275-ofpath-enable-NVMeoF-logical-device-transla.patch ++++ and /work/SRC/openSUSE:Factory/.grub2.new.19136/0002-ieee1275-ofpath-enable-NVMeoF-logical-device-transla.patch