]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ceph: fix dereference of null pointer cf
authorColin Ian King <colin.king@canonical.com>
Sun, 29 Aug 2021 18:18:24 +0000 (19:18 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 18 Sep 2021 11:41:44 +0000 (13:41 +0200)
commitb3672180cd1902de83bd8560632264511968dff7
tree7f68476d786df444b13bddcfb0921c9d72af7431
parent8fd8a060cbae37744e196ca63aa059a9fb23382c
ceph: fix dereference of null pointer cf

commit 05a444d3f90a3c3e6362e88a1bf13e1a60f8cace upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ceph/caps.c