8c4232d3f9
Modify 0104-RHBZ-631009-deferred-remove.patch * add man page info Refresh 0112-RHBZ-1194917-add-config_dir-option.patch Refresh 0114-RHBZ-1196394-delayed-reintegration.patch Add 0118-UPBZ-1200738-update-eternus-config.patch * update default config Add 0119-RHBZ-1081397-save-alua-info.patch * make prioritizers save information between calls to speed them up. Add 0120-RHBZ-1043093-realloc-fix.patch * free old memory if realloc fails. Add 0121-RHBZ-1197234-rules-fix.patch * make sure kpartx runs after an DM_ACTIVATION event occurs. Add 0122-RHBZ-1212590-dont-use-var.patch * use /run instead of /var/run Add 0123-UPBZ-1166072-fix-path-offline.patch * Don't mark quiesce and transport-offline paths as offline Add 0124-RHBZ-1209275-retrigger-uevents.patch * Make multipathd retrigger uevents when paths haven't successfully had their udev_attribute environment variable set by udev and add "retrigger_ties" and "retrigger_delay" to control this Add 0125-RHBZ-1153832-kpartx-delete.patch * Delete all partition devices with -d (not just the ones in the partition table) Add 0126-RHBZ-1211383-alias-collision.patch * make multipathd use the old alias, if rename failed and add "new_bindings_in_boot" to determine if new bindings can be added to the bindings file in the initramfs Add 0127-RHBZ-1201030-use-blk-availability.patch * Make multipath use blk-availability.service Add 0128-RHBZ-1222123-mpathconf-allow.patch * Add mpathconf --allow for creating specialized config files. Add 0129-RHBZ-1241774-sun-partition-numbering.patch * Make kpartx correctly number sun partitions.
196 lines
5.6 KiB
Diff
196 lines
5.6 KiB
Diff
---
|
|
libmultipath/dmparser.c | 6 ++++--
|
|
libmultipath/regex.c | 9 ++++++++-
|
|
multipath/main.c | 9 ++++++---
|
|
multipathd/cli_handlers.c | 41 ++++++++++++-----------------------------
|
|
multipathd/uxlsnr.c | 13 ++++++++++++-
|
|
5 files changed, 42 insertions(+), 36 deletions(-)
|
|
|
|
Index: multipath-tools-130222/libmultipath/dmparser.c
|
|
===================================================================
|
|
--- multipath-tools-130222.orig/libmultipath/dmparser.c
|
|
+++ multipath-tools-130222/libmultipath/dmparser.c
|
|
@@ -20,14 +20,16 @@
|
|
static int
|
|
merge_words (char ** dst, char * word, int space)
|
|
{
|
|
- char * p;
|
|
+ char * p = *dst;
|
|
int len;
|
|
|
|
len = strlen(*dst) + strlen(word) + space;
|
|
*dst = REALLOC(*dst, len + 1);
|
|
|
|
- if (!*dst)
|
|
+ if (!*dst) {
|
|
+ free(p);
|
|
return 1;
|
|
+ }
|
|
|
|
p = *dst;
|
|
|
|
Index: multipath-tools-130222/libmultipath/regex.c
|
|
===================================================================
|
|
--- multipath-tools-130222.orig/libmultipath/regex.c
|
|
+++ multipath-tools-130222/libmultipath/regex.c
|
|
@@ -123,7 +123,14 @@ static void init_syntax_once(void)
|
|
|
|
/* (Re)Allocate N items of type T using malloc, or fail. */
|
|
#define TALLOC(n, t) ((t *) malloc ((n) * sizeof (t)))
|
|
-#define RETALLOC(addr, n, t) ((addr) = (t *) realloc (addr, (n) * sizeof (t)))
|
|
+#define RETALLOC(addr, n, t) \
|
|
+do { \
|
|
+ t *tmp = (t *) realloc (addr, (n) * sizeof (t)); \
|
|
+ if (!tmp) \
|
|
+ free(addr); \
|
|
+ (addr) = tmp; \
|
|
+} while(0)
|
|
+
|
|
#define REGEX_TALLOC(n, t) ((t *) REGEX_ALLOCATE ((n) * sizeof (t)))
|
|
|
|
#define BYTEWIDTH 8 /* In bits. */
|
|
Index: multipath-tools-130222/multipath/main.c
|
|
===================================================================
|
|
--- multipath-tools-130222.orig/multipath/main.c
|
|
+++ multipath-tools-130222/multipath/main.c
|
|
@@ -394,7 +394,7 @@ out:
|
|
static int
|
|
dump_config (void)
|
|
{
|
|
- char * c;
|
|
+ char * c, * tmp = NULL;
|
|
char * reply;
|
|
unsigned int maxlen = 256;
|
|
int again = 1;
|
|
@@ -402,9 +402,12 @@ dump_config (void)
|
|
reply = MALLOC(maxlen);
|
|
|
|
while (again) {
|
|
- if (!reply)
|
|
+ if (!reply) {
|
|
+ if (tmp)
|
|
+ free(tmp);
|
|
return 1;
|
|
- c = reply;
|
|
+ }
|
|
+ c = tmp = reply;
|
|
c += snprint_defaults(c, reply + maxlen - c);
|
|
again = ((c - reply) == maxlen);
|
|
if (again) {
|
|
Index: multipath-tools-130222/multipathd/cli_handlers.c
|
|
===================================================================
|
|
--- multipath-tools-130222.orig/multipathd/cli_handlers.c
|
|
+++ multipath-tools-130222/multipathd/cli_handlers.c
|
|
@@ -26,11 +26,14 @@
|
|
#define REALLOC_REPLY(r, a, m) \
|
|
do { \
|
|
if ((a)) { \
|
|
+ char *tmp = (r); \
|
|
(r) = REALLOC((r), (m) * 2); \
|
|
if ((r)) { \
|
|
memset((r) + (m), 0, (m)); \
|
|
(m) *= 2; \
|
|
} \
|
|
+ else \
|
|
+ free(tmp); \
|
|
} \
|
|
} while (0)
|
|
|
|
@@ -144,7 +147,7 @@ show_config (char ** r, int * len)
|
|
unsigned int maxlen = INITIAL_REPLY_LEN;
|
|
int again = 1;
|
|
|
|
- reply = MALLOC(maxlen);
|
|
+ c = reply = MALLOC(maxlen);
|
|
|
|
while (again) {
|
|
if (!reply)
|
|
@@ -152,44 +155,24 @@ show_config (char ** r, int * len)
|
|
c = reply;
|
|
c += snprint_defaults(c, reply + maxlen - c);
|
|
again = ((c - reply) == maxlen);
|
|
- if (again) {
|
|
- reply = REALLOC(reply, maxlen * 2);
|
|
- if (!reply)
|
|
- return 1;
|
|
- memset(reply + maxlen, 0, maxlen);
|
|
- maxlen *= 2;
|
|
+ REALLOC_REPLY(reply, again, maxlen);
|
|
+ if (again)
|
|
continue;
|
|
- }
|
|
c += snprint_blacklist(c, reply + maxlen - c);
|
|
again = ((c - reply) == maxlen);
|
|
- if (again) {
|
|
- reply = REALLOC(reply, maxlen * 2);
|
|
- if (!reply)
|
|
- return 1;
|
|
- memset(reply + maxlen, 0, maxlen);
|
|
- maxlen *= 2;
|
|
+ REALLOC_REPLY(reply, again, maxlen);
|
|
+ if (again)
|
|
continue;
|
|
- }
|
|
c += snprint_blacklist_except(c, reply + maxlen - c);
|
|
again = ((c - reply) == maxlen);
|
|
- if (again) {
|
|
- reply = REALLOC(reply, maxlen * 2);
|
|
- if (!reply)
|
|
- return 1;
|
|
- memset(reply + maxlen, 0, maxlen);
|
|
- maxlen *= 2;
|
|
+ REALLOC_REPLY(reply, again, maxlen);
|
|
+ if (again)
|
|
continue;
|
|
- }
|
|
c += snprint_hwtable(c, reply + maxlen - c, conf->hwtable);
|
|
again = ((c - reply) == maxlen);
|
|
- if (again) {
|
|
- reply = REALLOC(reply, maxlen * 2);
|
|
- if (!reply)
|
|
- return 1;
|
|
- memset(reply + maxlen, 0, maxlen);
|
|
- maxlen *= 2;
|
|
+ REALLOC_REPLY(reply, again, maxlen);
|
|
+ if (again)
|
|
continue;
|
|
- }
|
|
c += snprint_mptable(c, reply + maxlen - c, conf->mptable);
|
|
again = ((c - reply) == maxlen);
|
|
REALLOC_REPLY(reply, again, maxlen);
|
|
Index: multipath-tools-130222/multipathd/uxlsnr.c
|
|
===================================================================
|
|
--- multipath-tools-130222.orig/multipathd/uxlsnr.c
|
|
+++ multipath-tools-130222/multipathd/uxlsnr.c
|
|
@@ -64,6 +64,10 @@ static void new_client(int ux_sock)
|
|
|
|
/* put it in our linked list */
|
|
c = (struct client *)MALLOC(sizeof(*c));
|
|
+ if (!c) {
|
|
+ close(fd);
|
|
+ return;
|
|
+ }
|
|
memset(c, 0, sizeof(*c));
|
|
c->fd = fd;
|
|
c->next = clients;
|
|
@@ -124,11 +128,18 @@ void * uxsock_listen(int (*uxsock_trigge
|
|
sigdelset(&mask, SIGHUP);
|
|
sigdelset(&mask, SIGUSR1);
|
|
while (1) {
|
|
+ struct pollfd *tmp;
|
|
struct client *c;
|
|
int i, poll_count;
|
|
|
|
/* setup for a poll */
|
|
- polls = REALLOC(polls, (1+num_clients) * sizeof(*polls));
|
|
+ tmp = REALLOC(polls, (1+num_clients) * sizeof(*polls));
|
|
+ /* If we can't allocate poliing space for the new client,
|
|
+ * close it */
|
|
+ if (!tmp)
|
|
+ dead_client(clients);
|
|
+ else
|
|
+ polls = tmp;
|
|
polls[0].fd = ux_sock;
|
|
polls[0].events = POLLIN;
|
|
|