All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brian Chrisman <brchrisman@gmail.com>
To: ceph-devel@vger.kernel.org
Cc: Brian Chrisman <brchrisman@gmail.com>
Subject: [PATCH 1/2] fix null deref when callback invoked en route from readdir_r rather than readdirplus_r
Date: Thu, 12 May 2011 23:39:37 -0700	[thread overview]
Message-ID: <1305268778-18691-2-git-send-email-brchrisman@gmail.com> (raw)
In-Reply-To: <1305268778-18691-1-git-send-email-brchrisman@gmail.com>


Signed-off-by: Brian Chrisman <brchrisman@gmail.com>
---
 src/client/Client.cc |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/client/Client.cc b/src/client/Client.cc
index 8b8fcf1..dbac2c9 100644
--- a/src/client/Client.cc
+++ b/src/client/Client.cc
@@ -4330,8 +4330,12 @@ static int _readdir_single_dirent_cb(void *p, struct dirent *de, struct stat *st
     return -1;
 
   *c->de = *de;
-  *c->st = *st;
-  *c->stmask = stmask;
+  if (c->st) {
+    *c->st = *st;
+  }
+  if (c->stmask) {
+    *c->stmask = stmask;
+  }
   c->full = true;
   return 0;  
 }
-- 
1.7.1


  reply	other threads:[~2011-05-13  6:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-13  6:39 [PATCH 0/2] fix null deref in readdir_r callback and test Brian Chrisman
2011-05-13  6:39 ` Brian Chrisman [this message]
2011-05-13  6:39 ` [PATCH 2/2] add basic test case for readdir_r Brian Chrisman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1305268778-18691-2-git-send-email-brchrisman@gmail.com \
    --to=brchrisman@gmail.com \
    --cc=ceph-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.