[Bugs] [Bug 1505856] New: Potential use of NULL `this` variable before it gets initialized
bugzilla at redhat.com
bugzilla at redhat.com
Tue Oct 24 12:03:06 UTC 2017
https://bugzilla.redhat.com/show_bug.cgi?id=1505856
Bug ID: 1505856
Summary: Potential use of NULL `this` variable before it gets
initialized
Product: GlusterFS
Version: 3.12
Component: changelog
Severity: low
Assignee: bugs at gluster.org
Reporter: khiremat at redhat.com
CC: alexc at sbrella.com, avishwan at redhat.com,
bugs at gluster.org
Depends On: 1503405, 1505325
+++ This bug was initially created as a clone of Bug #1505325 +++
+++ This bug was initially created as a clone of Bug #1503405 +++
Description of problem:
Our code scanner has reported a potential null pointer dereference at
xlators/features/changelog/lib/src/gf-history-changelog.c
xlator_t *this = NULL;
........
pthread_attr_t attr;
ret = pthread_attr_init (&attr);
if (ret != 0) {
gf_msg (this->name, GF_LOG_ERROR, errno, // <== `this`
variable is still NULL at this time.
CHANGELOG_LIB_MSG_PTHREAD_ERROR,
"Pthread init failed");
return -1;
}
this = THIS; // `this` variable gets assignment here, it was NULL
before that
if (!this) {
ret = -1;
goto out;
}
according to the documentation of pthread_attr_init, the chance of its
invocation failure is low, but once happened, the process will crash (the GEO
replication syncdaemon seems using this function).
Regards,
Alex, SourceBrella Inc.
--- Additional comment from Worker Ant on 2017-10-23 06:52:33 EDT ---
REVIEW: https://review.gluster.org/18553 (libgfchangelog: Fix possible null
pointer dereference) posted (#1) for review on master by Kotresh HR
(khiremat at redhat.com)
--- Additional comment from Worker Ant on 2017-10-24 01:25:01 EDT ---
COMMIT: https://review.gluster.org/18553 committed in master by Aravinda VK
(avishwan at redhat.com)
------
commit 738c38f0efa7b4d4dab0cf23d00589d68e4eb88d
Author: Kotresh HR <khiremat at redhat.com>
Date: Mon Oct 23 06:46:49 2017 -0400
libgfchangelog: Fix possible null pointer dereference
If pthread_attr_init fails, gf_msg uses this->name
where 'this' is not initialized yet. This patch fixes
the same.
Change-Id: Ie004cbe1015a0d62fc3b5512e8954c5606eeeb5f
Signed-off-by: Kotresh HR <khiremat at redhat.com>
BUG: 1505325
Referenced Bugs:
https://bugzilla.redhat.com/show_bug.cgi?id=1503405
[Bug 1503405] Potential use of NULL `this` variable before it gets
initialized
https://bugzilla.redhat.com/show_bug.cgi?id=1505325
[Bug 1505325] Potential use of NULL `this` variable before it gets
initialized
--
You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.
More information about the Bugs
mailing list