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 11:12:46 +0000 (13:12 +0200)
commit75bd1d78e8a5e0d01ed2ad58711462f3b9303e72
treebfe9791d07d0c44217c6911545a39b6eee418e23
parent8a42f87c75dfa504f49ae95b504ee57d30821b8a
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