Gitweb: http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitdif…
Commit: 2d2b671fc8118f4896b9cfdd33c1631a850ae42b
Parent: c7c11093e8182f27ad543457028a7ccbd9f00212
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Thu Aug 4 10:39:05 2011 +0100
Committer: Andrew Price <anprice(a)redhat.com>
CommitterDate: Thu Aug 4 10:44:53 2011 +0100
tunegfs2: Add some malloc error checking
Static analysis found a possible null pointer dereference due to a
missing check in read_super. The malloc'd memory was also not being
freed on error conditions. This patch adds a check for a null pointer
and frees the allocated memory.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/tune/super.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/gfs2/tune/super.c b/gfs2/tune/super.c
index 65e8d5b..49d87d6 100644
--- a/gfs2/tune/super.c
+++ b/gfs2/tune/super.c
@@ -94,14 +94,21 @@ int read_super(struct tunegfs2 *tfs)
int n;
tfs->sb_start = GFS2_SB_ADDR << GFS2_BASIC_BLOCK_SHIFT;
block = malloc(sizeof(char) * GFS2_DEFAULT_BSIZE);
+ if (!block) {
+ perror("read_super: malloc");
+ return EX_UNAVAILABLE;
+ }
n = pread(tfs->fd, block, GFS2_DEFAULT_BSIZE, tfs->sb_start);
if (n < 0) {
perror("read_super: pread");
+ free(block);
return EX_IOERR;
}
tfs->sb = block;
if (be32_to_cpu(tfs->sb->sb_header.mh_magic) != GFS2_MAGIC) {
fprintf(stderr, _("Not a GFS/GFS2 device\n"));
+ tfs->sb = NULL;
+ free(block);
return EX_IOERR;
}
/* Ensure that table and proto are NULL terminated */
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=53…
Commit: 53d23b0172773b2a17bb2a019d4bbc2118d9e307
Parent: ad95ee30836d14185885596b64ee4cff30729c51
Author: Lon Hohberger <lhh(a)redhat.com>
AuthorDate: Tue Aug 2 09:53:20 2011 -0400
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Tue Aug 2 11:15:30 2011 -0400
rgmanager: Fix race in shutdown vs. notification
The check of db prior to taking the mutex was done as a tiny performance
gain in the event that there was no dbus connection, but causes
dbus_connection_get_is_connected() to crash the program if db is NULL.
Resolves: rhbz#697446
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto(a)redhat.com>
---
rgmanager/src/daemons/update-dbus.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/rgmanager/src/daemons/update-dbus.c b/rgmanager/src/daemons/update-dbus.c
index f465d1d..bff1644 100644
--- a/rgmanager/src/daemons/update-dbus.c
+++ b/rgmanager/src/daemons/update-dbus.c
@@ -149,12 +149,12 @@ _rgm_dbus_notify(const char *svcname,
DBusMessage *msg = NULL;
int ret = -1;
+ pthread_mutex_lock(&mu);
+
if (!db) {
- goto out_free;
+ goto out_unlock;
}
- pthread_mutex_lock(&mu);
-
/* Check to ensure the connection is still valid. If it
* isn't, clean up and shut down the dbus connection.
*
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=53…
Commit: 538becbe4b3779bf8173e6c09164aa7c8d5521ad
Parent: b5f6b9d830bc4111d6de37ffe5bd7ea2c30f989c
Author: Lon Hohberger <lhh(a)redhat.com>
AuthorDate: Tue Aug 2 09:53:20 2011 -0400
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Tue Aug 2 10:47:38 2011 -0400
rgmanager: Fix race in shutdown vs. notification
The check of db prior to taking the mutex was done as a tiny performance
gain in the event that there was no dbus connection, but causes
dbus_connection_get_is_connected() to crash the program if db is NULL.
Resolves: rhbz#697446
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
---
rgmanager/src/daemons/update-dbus.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/rgmanager/src/daemons/update-dbus.c b/rgmanager/src/daemons/update-dbus.c
index f465d1d..bff1644 100644
--- a/rgmanager/src/daemons/update-dbus.c
+++ b/rgmanager/src/daemons/update-dbus.c
@@ -149,12 +149,12 @@ _rgm_dbus_notify(const char *svcname,
DBusMessage *msg = NULL;
int ret = -1;
+ pthread_mutex_lock(&mu);
+
if (!db) {
- goto out_free;
+ goto out_unlock;
}
- pthread_mutex_lock(&mu);
-
/* Check to ensure the connection is still valid. If it
* isn't, clean up and shut down the dbus connection.
*
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=b5…
Commit: b5f6b9d830bc4111d6de37ffe5bd7ea2c30f989c
Parent: 8e6660824136681b73506d49776f70b8a372ec63
Author: Lon Hohberger <lhh(a)redhat.com>
AuthorDate: Mon Aug 1 16:31:57 2011 -0400
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Mon Aug 1 16:35:55 2011 -0400
rgmanager: Fix clusvcadm message when run with -F
The new_owner was not being correctly set when enabling a service with
-F when run without central processing enabled.
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
---
rgmanager/src/daemons/rg_state.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/rgmanager/src/daemons/rg_state.c b/rgmanager/src/daemons/rg_state.c
index 9292add..3db6bd9 100644
--- a/rgmanager/src/daemons/rg_state.c
+++ b/rgmanager/src/daemons/rg_state.c
@@ -2300,6 +2300,7 @@ handle_fd_start_req(char *svcName, int request, int *new_owner)
switch(ret) {
case RG_ESUCCESS:
+ *new_owner = target;
ret = RG_ESUCCESS;
goto out;
case RG_ERUN: