summaryrefslogtreecommitdiffstats
path: root/xlators/features/locks
diff options
context:
space:
mode:
authorXavi Hernandez <xhernandez@redhat.com>2019-04-17 08:58:57 +0200
committerAmar Tumballi <amarts@redhat.com>2019-04-19 16:08:50 +0000
commit02a7a9ef1c0703990d6333b8b800a36da04c9f3e (patch)
tree8235a9372e1ec97caac974419c11cdfff726e696 /xlators/features/locks
parent1ad201a9fd6748d7ef49fb073fcfe8c6858d557d (diff)
features/locks: fix coverity issues
This patch fixes the following NULL dereferences identified by Coverity: * CID 1398619 * CID 1398621 * CID 1398623 * CID 1398625 * CID 1398626 Change-Id: Id6af0d7cba0bb3346005376bc27180e8476255a4 Updates: bz#789278 Signed-off-by: Xavi Hernandez <xhernandez@redhat.com>
Diffstat (limited to 'xlators/features/locks')
-rw-r--r--xlators/features/locks/src/common.c2
-rw-r--r--xlators/features/locks/src/posix.c5
2 files changed, 6 insertions, 1 deletions
diff --git a/xlators/features/locks/src/common.c b/xlators/features/locks/src/common.c
index 6e7fb4b2f63..9e06484308e 100644
--- a/xlators/features/locks/src/common.c
+++ b/xlators/features/locks/src/common.c
@@ -478,7 +478,7 @@ pl_inode_get(xlator_t *this, inode_t *inode, pl_local_t *local)
unlock:
UNLOCK(&inode->lock);
- if (pl_is_mandatory_locking_enabled(pl_inode) &&
+ if ((pl_inode != NULL) && pl_is_mandatory_locking_enabled(pl_inode) &&
pl_inode->check_mlock_info && local) {
/* Note: The lock enforcement information per file can be stored in the
attribute flag of stat(x) in posix. With that there won't be a need
diff --git a/xlators/features/locks/src/posix.c b/xlators/features/locks/src/posix.c
index 3f1c7a733ff..9d7210f1bb5 100644
--- a/xlators/features/locks/src/posix.c
+++ b/xlators/features/locks/src/posix.c
@@ -125,6 +125,11 @@ fetch_pathinfo(xlator_t *, inode_t *, int32_t *, char **);
(name && (strcmp(name, GF_ENFORCE_MANDATORY_LOCK) == 0))) { \
inode_t *__inode = (loc ? loc->inode : fd->inode); \
pl_inode_t *__pl_inode = pl_inode_get(this, __inode, NULL); \
+ if (__pl_inode == NULL) { \
+ op_ret = -1; \
+ op_errno = ENOMEM; \
+ goto unwind; \
+ } \
if (!pl_is_mandatory_locking_enabled(__pl_inode) || \
!priv->mlock_enforced) { \
op_ret = -1; \