]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
libceph: allow ceph_buffer_put() to receive a NULL ceph_buffer
authorLuis Henriques <lhenriques@suse.com>
Fri, 19 Jul 2019 14:32:19 +0000 (15:32 +0100)
committerKhalid Elmously <khalid.elmously@canonical.com>
Thu, 26 Sep 2019 04:34:52 +0000 (00:34 -0400)
BugLink: https://bugs.launchpad.net/bugs/1843463
[ Upstream commit 5c498950f730aa17c5f8a2cdcb903524e4002ed2 ]

Signed-off-by: Luis Henriques <lhenriques@suse.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
include/linux/ceph/buffer.h

index 5e58bb29b1a36b55e86bf8951cd04eaf149853e5..11cdc7c60480f503aa510b5b54368ac66df45a86 100644 (file)
@@ -30,7 +30,8 @@ static inline struct ceph_buffer *ceph_buffer_get(struct ceph_buffer *b)
 
 static inline void ceph_buffer_put(struct ceph_buffer *b)
 {
-       kref_put(&b->kref, ceph_buffer_release);
+       if (b)
+               kref_put(&b->kref, ceph_buffer_release);
 }
 
 extern int ceph_decode_buffer(struct ceph_buffer **b, void **p, void *end);