summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>2013-05-31 18:49:30 +0200
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>2013-05-31 19:15:22 +0200
commit59cffbabcffa2c55acf43eb604d42c7a24d405c3 (patch)
treeba0e3afdf16d29cfb71abab8d9801e6f11083547
parent3969c695d947eb4a41928710503c82beaaf58e43 (diff)
downloadceph-59cffbabcffa2c55acf43eb604d42c7a24d405c3.tar.gz
mds/Locker.cc: fix dereference after null check
CID 716919 (#1 of 1): Dereference after null check (FORWARD_NULL) var_deref_model: Passing null pointer "cap" to function "Capability::inc_suppress()", which dereferences it. Check for 'cap' before use it as in other places of the function. Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
-rw-r--r--src/mds/Locker.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/mds/Locker.cc b/src/mds/Locker.cc
index 41421f3e2a6..74a766256b4 100644
--- a/src/mds/Locker.cc
+++ b/src/mds/Locker.cc
@@ -2794,7 +2794,8 @@ bool Locker::_do_cap_update(CInode *in, Capability *cap,
dout(10) << " i want to change file_max, but lock won't allow it (yet)" << dendl;
if (in->filelock.is_stable()) {
bool need_issue = false;
- cap->inc_suppress();
+ if (cap)
+ cap->inc_suppress();
if (in->mds_caps_wanted.empty() &&
(in->get_loner() >= 0 || (in->get_wanted_loner() >= 0 && in->try_set_loner()))) {
if (in->filelock.get_state() != LOCK_EXCL)
@@ -2803,7 +2804,8 @@ bool Locker::_do_cap_update(CInode *in, Capability *cap,
simple_lock(&in->filelock, &need_issue);
if (need_issue)
issue_caps(in);
- cap->dec_suppress();
+ if (cap)
+ cap->dec_suppress();
}
if (!in->filelock.can_wrlock(client) &&
!in->filelock.can_force_wrlock(client)) {