ceph: fix potential race in ceph_check_caps
authorJeff Layton <jlayton@kernel.org>
Fri, 20 Mar 2020 20:45:45 +0000 (16:45 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 1 Oct 2020 18:40:15 +0000 (20:40 +0200)
commit43137370e95c10816c156504d46a25af2147ad12
treeb40cf29b29ead205054071352cc221431fd86f3f
parent5a30a8105ff7745079b1a3ce38b2e397d8c803a3
ceph: fix potential race in ceph_check_caps

[ Upstream commit dc3da0461cc4b76f2d0c5b12247fcb3b520edbbf ]

Nothing ensures that session will still be valid by the time we
dereference the pointer. Take and put a reference.

In principle, we should always be able to get a reference here, but
throw a warning if that's ever not the case.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/ceph/caps.c