summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2011-05-13 00:13:23 +0200
committerSage Weil <sage@newdream.net>2011-05-19 20:25:03 +0200
commit3540303f87115cbdae6ed2cab44ce6a7676d48d3 (patch)
treeeb1003ac91370488972e3e5b126771707cf98a88
parentlibceph: use snprintf for unknown addrs (diff)
downloadlinux-3540303f87115cbdae6ed2cab44ce6a7676d48d3.tar.xz
linux-3540303f87115cbdae6ed2cab44ce6a7676d48d3.zip
ceph: fix rare potential cap leak
If we grab new_cap, retake the lock, and find we already have a cap now for the given mds, release new_cap. Signed-off-by: Sage Weil <sage@newdream.net>
-rw-r--r--fs/ceph/caps.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index 2a5404c1c42f..591202bc9668 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -569,7 +569,8 @@ retry:
list_add_tail(&cap->session_caps, &session->s_caps);
session->s_nr_caps++;
spin_unlock(&session->s_cap_lock);
- }
+ } else if (new_cap)
+ ceph_put_cap(mdsc, new_cap);
if (!ci->i_snap_realm) {
/*