From: Luis Henriques Date: Fri, 19 Jul 2019 14:32:19 +0000 (+0100) Subject: libceph: allow ceph_buffer_put() to receive a NULL ceph_buffer X-Git-Tag: v4.9.192~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=05700fe421866f60f63fbb3a02852425a9bd9447;p=platform%2Fkernel%2Flinux-amlogic.git libceph: allow ceph_buffer_put() to receive a NULL ceph_buffer [ Upstream commit 5c498950f730aa17c5f8a2cdcb903524e4002ed2 ] Signed-off-by: Luis Henriques Reviewed-by: Jeff Layton Signed-off-by: Ilya Dryomov Signed-off-by: Sasha Levin --- diff --git a/include/linux/ceph/buffer.h b/include/linux/ceph/buffer.h index 07ca15e76100..dada47a4360f 100644 --- a/include/linux/ceph/buffer.h +++ b/include/linux/ceph/buffer.h @@ -29,7 +29,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);