From f004b82b5cfe93f467ef65b2c8bb9e15c07c6215 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Apr 27 2009 18:38:29 +0000 Subject: - Don't crash when asked to parse the ppc firmware table more then once (which can be done from libiscsi) (#491363) --- diff --git a/iscsi-initiator-utils.spec b/iscsi-initiator-utils.spec index bbc4f9d..0c15b66 100644 --- a/iscsi-initiator-utils.spec +++ b/iscsi-initiator-utils.spec @@ -3,7 +3,7 @@ Summary: iSCSI daemon and utility programs Name: iscsi-initiator-utils Version: 6.2.0.870 -Release: 8%{?dist} +Release: 9%{?dist} Source0: http://www.open-iscsi.org/bits/open-iscsi-2.0-870.1.tar.gz Source1: iscsid.init Source2: iscsidevs.init @@ -19,7 +19,7 @@ Patch7: open-iscsi-2.0-870.1-add-libiscsi.patch Patch8: open-iscsi-2.0-870.1-no-exit.patch Patch9: open-iscsi-2.0-870.1-ibft-newer-kernel.patch Patch10: open-iscsi-2.0-870.1-485217.patch -Patch11: open-iscsi-2.0-870.1-490515-workaround.patch +Patch11: open-iscsi-2.0-870.1-fwparam-ppc-crash.patch Group: System Environment/Daemons License: GPLv2+ @@ -162,6 +162,10 @@ fi %{_includedir}/libiscsi.h %changelog +* Mon Apr 27 2009 Hans de Goede 6.2.0.870-9 +- Don't crash when asked to parse the ppc firmware table more then + once (which can be done from libiscsi) (#491363) + * Fri Apr 3 2009 Hans de Goede 6.2.0.870-8 - Stop the NM script from exiting with an error status when it didn't do anything (#493411) diff --git a/open-iscsi-2.0-870.1-490515-workaround.patch b/open-iscsi-2.0-870.1-490515-workaround.patch deleted file mode 100644 index 970461d..0000000 --- a/open-iscsi-2.0-870.1-490515-workaround.patch +++ /dev/null @@ -1,45 +0,0 @@ -diff -up open-iscsi-2.0-870.1/include/fw_context.h.workaround open-iscsi-2.0-870.1/include/fw_context.h ---- open-iscsi-2.0-870.1/include/fw_context.h.workaround 2009-03-20 15:47:16.000000000 +0100 -+++ open-iscsi-2.0-870.1/include/fw_context.h 2009-03-20 15:48:03.000000000 +0100 -@@ -51,5 +51,7 @@ struct boot_context { - - extern int fw_get_entry(struct boot_context *context, const char *filepath); - extern void fw_print_entry(struct boot_context *context); -+extern int fwparam_ibft_sysfs(struct boot_context *context, -+ const char *filepath); - - #endif /* FWPARAM_CONTEXT_H_ */ -diff -up open-iscsi-2.0-870.1/libiscsi/libiscsi.c.workaround open-iscsi-2.0-870.1/libiscsi/libiscsi.c ---- open-iscsi-2.0-870.1/libiscsi/libiscsi.c.workaround 2009-03-20 15:45:28.000000000 +0100 -+++ open-iscsi-2.0-870.1/libiscsi/libiscsi.c 2009-03-20 15:47:03.000000000 +0100 -@@ -196,10 +196,10 @@ int libiscsi_discover_firmware(struct li - *found_nodes = NULL; - - memset(&fw_entry, 0, sizeof fw_entry); -- rc = fw_get_entry(&fw_entry, NULL); -+ rc = fwparam_ibft_sysfs(&fw_entry, NULL); - if (rc) { - strcpy(context->error_str, "Could not read fw values."); -- return rc; -+ return ENODEV; - } - - memset(&rec, 0, sizeof rec); -@@ -535,7 +535,7 @@ int libiscsi_get_firmware_network_config - - memset(config, 0, sizeof *config); - memset(&fw_entry, 0, sizeof fw_entry); -- if (fw_get_entry(&fw_entry, NULL)) -+ if (fwparam_ibft_sysfs(&fw_entry, NULL)) - return ENODEV; - - config->dhcp = strlen(fw_entry.dhcp) ? 1 : 0; -@@ -557,7 +557,7 @@ int libiscsi_get_firmware_initiator_name - - memset(initiatorname, 0, LIBISCSI_VALUE_MAXLEN); - memset(&fw_entry, 0, sizeof fw_entry); -- if (fw_get_entry(&fw_entry, NULL)) -+ if (fwparam_ibft_sysfs(&fw_entry, NULL)) - return ENODEV; - - strncpy(initiatorname, fw_entry.initiatorname, diff --git a/open-iscsi-2.0-870.1-fwparam-ppc-crash.patch b/open-iscsi-2.0-870.1-fwparam-ppc-crash.patch new file mode 100644 index 0000000..d2fdba2 --- /dev/null +++ b/open-iscsi-2.0-870.1-fwparam-ppc-crash.patch @@ -0,0 +1,55 @@ +diff -up open-iscsi-2.0-870.1/utils/fwparam_ibft/fwparam_ppc.c.crash open-iscsi-2.0-870.1/utils/fwparam_ibft/fwparam_ppc.c +--- open-iscsi-2.0-870.1/utils/fwparam_ibft/fwparam_ppc.c.crash 2008-11-22 18:06:46.000000000 +0100 ++++ open-iscsi-2.0-870.1/utils/fwparam_ibft/fwparam_ppc.c 2009-04-27 20:33:33.000000000 +0200 +@@ -341,6 +341,7 @@ static int loop_devs(const char *devtree + int i; + char prefix[256]; + ++ nic_count = 0; + error = nftw(devtree, find_nics, 20, 0); + if (error) + return error; +@@ -352,6 +353,7 @@ static int loop_devs(const char *devtree + qsort(niclist, nic_count, sizeof(char *), nic_cmp); + + snprintf(prefix, sizeof(prefix), "%s/%s", devtree, "aliases"); ++ dev_count = 0; + error = nftw(prefix, find_initiator, 20, 0); + if (error) + return error; +@@ -366,8 +368,6 @@ static int loop_devs(const char *devtree + + } + } +- if (!error) +- putchar('\n'); + return error; + } + +@@ -425,7 +425,7 @@ static void fill_context(struct boot_con + int fwparam_ppc(struct boot_context *context, const char *filepath) + { + int error; +- int fplen = 0; ++ int dev_count; + char *devtree; + + /* +@@ -435,13 +435,10 @@ int fwparam_ppc(struct boot_context *con + * systems that can support iscsi are the ones that provide + * the appropriate FCODE with a load method. + */ +- if (filepath) { +- strncat(filename, filepath, FILENAMESZ); +- fplen = strlen(filename); +- } else +- strncat(filename, DT_TOP, FILENAMESZ); +- +- strncat(filename + fplen, BOOTPATH, FILENAMESZ - fplen); ++ if (filepath) ++ snprintf(filename, FILENAMESZ, "%s%s", filepath, BOOTPATH); ++ else ++ snprintf(filename, FILENAMESZ, "%s%s", DT_TOP, BOOTPATH); + + if (debug) + fprintf(stderr, "%s: file:%s; debug:%d\n", __func__, filename,