From: Sage Weil Date: Thu, 12 May 2011 22:13:23 +0000 (-0700) Subject: ceph: fix rare potential cap leak X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=3540303f87115cbdae6ed2cab44ce6a7676d48d3;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git 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 --- 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) { /*