Skip to content

Commit 5c49895

Browse files
Luis Henriquesidryomov
authored andcommitted
libceph: allow ceph_buffer_put() to receive a NULL ceph_buffer
Signed-off-by: Luis Henriques <lhenriques@suse.com> Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
1 parent d1abaeb commit 5c49895

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

include/linux/ceph/buffer.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ static inline struct ceph_buffer *ceph_buffer_get(struct ceph_buffer *b)
3030

3131
static inline void ceph_buffer_put(struct ceph_buffer *b)
3232
{
33-
kref_put(&b->kref, ceph_buffer_release);
33+
if (b)
34+
kref_put(&b->kref, ceph_buffer_release);
3435
}
3536

3637
extern int ceph_decode_buffer(struct ceph_buffer **b, void **p, void *end);

0 commit comments

Comments
 (0)