From 6917011ee224fc41f6ca46a674d9c2df4e72913a Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Tue, 22 Dec 2009 01:53:33 +0000 Subject: properly ref/unref fd in stripe_opendir_cbk fixes the crash due to dereferencing NULL fd pointer Signed-off-by: Amar Tumballi Signed-off-by: Vijay Bellur BUG: 497 (Client crashes in fuse_fd_cbk while running ltp tests) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=497 --- xlators/cluster/stripe/src/stripe.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/xlators/cluster/stripe/src/stripe.c b/xlators/cluster/stripe/src/stripe.c index 5dc3dd8b61d..66f2e0b90b3 100644 --- a/xlators/cluster/stripe/src/stripe.c +++ b/xlators/cluster/stripe/src/stripe.c @@ -2277,6 +2277,7 @@ stripe_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, { int32_t callcnt = 0; stripe_local_t *local = frame->local; + fd_t *local_fd = NULL; LOCK (&frame->lock); { @@ -2297,8 +2298,11 @@ stripe_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, UNLOCK (&frame->lock); if (!callcnt) { + local_fd = local->fd; STACK_UNWIND (frame, local->op_ret, local->op_errno, local->fd); + if (local_fd) + fd_unref (local_fd); } return 0; @@ -2338,6 +2342,7 @@ stripe_opendir (call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd) } frame->local = local; local->call_count = priv->child_count; + local->fd = fd_ref (fd); while (trav) { STACK_WIND (frame, stripe_opendir_cbk, trav->xlator, -- cgit