summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSanju Rakonde <srakonde@redhat.com>2017-10-17 18:53:37 +0530
committerSanju Rakonde <srakonde@redhat.com>2017-10-17 18:57:24 +0530
commit1f48d17fee0cac95648ec34d13f038b27ef5c6ac (patch)
tree55f4b98d2b90fe0f67e969b64b6f2c0126c3814b
parentccec52220f4d2fb148c1bb1573a11b1727af7a0c (diff)
glusterd:Dereferencing the null pointer
Problem: When we reach at the out, iobref, iobuf, frame can be null. for iobref, iobuf at out we are calling iobref_unref() and iobuf_unref() respectively, which are using GF_VALIDATE_OR_GOTO(), so there won't be null pointer dereference. But for frame without null checking we are giving STACK_DESTROY(frame->root), causing null pointer dereference. Fix: We are adding a line for null checking, we call the function STACK_DESTROY(frame->root) only when frame is not null. Change-Id: I6b466a35326a5509bcc510321c24a1d2cf41ca1a BUG: 1502928 Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
-rw-r--r--glusterfsd/src/gf_attach.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/glusterfsd/src/gf_attach.c b/glusterfsd/src/gf_attach.c
index 05119e4f4ca..3f248292ddf 100644
--- a/glusterfsd/src/gf_attach.c
+++ b/glusterfsd/src/gf_attach.c
@@ -144,7 +144,8 @@ out:
iobref_unref (iobref);
iobuf_unref (iobuf);
- STACK_DESTROY (frame->root);
+ if (frame)
+ STACK_DESTROY (frame->root);
if (rpc_status != 0) {
fprintf (stderr, "got error %d on RPC\n", rpc_status);