libglusterfs/inode: Fix NULL dereferences.

There could be scenarios where the inode_ctx_get() can
be called to only check if the context exists, in such
cases the buffer for the context might not have been passed.
Hence fix inode_ctx_get() to not crash, when the buffer
is not passed.

Change-Id: I607d86eb401ccab0e5cd75f6f977c454994ec063
BUG: 789278
Signed-off-by: Poornima G <pgurusid@redhat.com>
Reviewed-on: http://review.gluster.org/7167
Reviewed-by: Santosh Pradhan <spradhan@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
This commit is contained in:
Poornima G 2014-02-28 12:13:55 +05:30 committed by Anand Avati
parent 7b3399cd46
commit 9f45d0f621

View File

@ -1599,7 +1599,7 @@ __inode_ctx_get0 (inode_t *inode, xlator_t *xlator, uint64_t *value1)
int ret = 0;
ret = __inode_ctx_get2 (inode, xlator, &tmp_value, NULL);
if (!ret)
if (!ret && value1)
*value1 = tmp_value;
return ret;
@ -1612,7 +1612,7 @@ __inode_ctx_get1 (inode_t *inode, xlator_t *xlator, uint64_t *value2)
int ret = 0;
ret = __inode_ctx_get2 (inode, xlator, NULL, &tmp_value);
if (!ret)
if (!ret && value2)
*value2 = tmp_value;
return ret;