summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorShwetha Acharya <sacharya@redhat.com>2018-10-11 11:27:44 +0530
committerShwetha Acharya <sacharya@redhat.com>2018-10-11 15:26:54 +0530
commit807ec72d740a4548c250cc660c89fc59d2f191d6 (patch)
tree538b4aa325b88bfe97b8b1d97dd92b64125bd307 /xlators
parent23e96fd93c021d4647b940a47df2250fe9159a3b (diff)
performance/write-behind: NULL pointer passed to a nonnull parameter
Problem: wb_directory_inode->lock can be null. Solution: added a condition, if(!wb_directory_inode->lock.spinlock) to address the issue (checked one of the attributes of union lock to ensure that union is not null). Updates: bz#1622665 Change-Id: I0749ee16aa2c23f51d4b4c7b0979d494bcd4d90e Signed-off-by: Shwetha Acharya <sacharya@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/performance/write-behind/src/write-behind.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/xlators/performance/write-behind/src/write-behind.c b/xlators/performance/write-behind/src/write-behind.c
index c4f53e425bc..ad226932852 100644
--- a/xlators/performance/write-behind/src/write-behind.c
+++ b/xlators/performance/write-behind/src/write-behind.c
@@ -2471,6 +2471,9 @@ wb_mark_readdirp_start(xlator_t *this, inode_t *directory)
wb_directory_inode = wb_inode_create(this, directory);
+ if (!wb_directory_inode->lock.spinlock)
+ return;
+
LOCK(&wb_directory_inode->lock);
{
GF_ATOMIC_INC(wb_directory_inode->readdirps);
@@ -2488,6 +2491,9 @@ wb_mark_readdirp_end(xlator_t *this, inode_t *directory)
wb_directory_inode = wb_inode_ctx_get(this, directory);
+ if (!wb_directory_inode->lock.spinlock)
+ return;
+
LOCK(&wb_directory_inode->lock);
{
readdirps = GF_ATOMIC_DEC(wb_directory_inode->readdirps);