diff options
author | 2021-08-29 19:18:24 +0100 | |
---|---|---|
committer | 2021-09-03 10:55:51 +0200 | |
commit | 05a444d3f90a3c3e6362e88a1bf13e1a60f8cace (patch) | |
tree | c8c903b6b92af9be2cfaa031f2569508f81087bd /fs/ceph | |
parent | ceph: drop the mdsc_get_session/put_session dout messages (diff) | |
download | linux-05a444d3f90a3c3e6362e88a1bf13e1a60f8cace.tar.gz linux-05a444d3f90a3c3e6362e88a1bf13e1a60f8cace.tar.bz2 linux-05a444d3f90a3c3e6362e88a1bf13e1a60f8cace.zip |
ceph: fix dereference of null pointer cf
Currently in the case where kmem_cache_alloc fails the null pointer
cf is dereferenced when assigning cf->is_capsnap = false. Fix this
by adding a null pointer check and return path.
Cc: stable@vger.kernel.org
Addresses-Coverity: ("Dereference null return")
Fixes: b2f9fa1f3bd8 ("ceph: correctly handle releasing an embedded cap flush")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'fs/ceph')
-rw-r--r-- | fs/ceph/caps.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index 26c5029629a4..6c0e52fd0743 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c @@ -1736,6 +1736,9 @@ struct ceph_cap_flush *ceph_alloc_cap_flush(void) struct ceph_cap_flush *cf; cf = kmem_cache_alloc(ceph_cap_flush_cachep, GFP_KERNEL); + if (!cf) + return NULL; + cf->is_capsnap = false; return cf; } |