#include #include #include #include #include #include /* for ceph_kvmalloc */ struct ceph_buffer *ceph_buffer_new(size_t len, gfp_t gfp) { struct ceph_buffer *b; b = kmalloc(sizeof(*b), gfp); if (!b) return NULL; b->vec.iov_base = ceph_kvmalloc(len, gfp); if (!b->vec.iov_base) { kfree(b); return NULL; } kref_init(&b->kref); b->alloc_len = len; b->vec.iov_len = len; dout("buffer_new %p\n", b); return b; } EXPORT_SYMBOL(ceph_buffer_new); void ceph_buffer_release(struct kref *kref) { struct ceph_buffer *b = container_of(kref, struct ceph_buffer, kref); dout("buffer_release %p\n", b); kvfree(b->vec.iov_base); kfree(b); } EXPORT_SYMBOL(ceph_buffer_release); int ceph_decode_buffer(struct ceph_buffer **b, void **p, void *end) { size_t len; ceph_decode_need(p, end, sizeof(u32), bad); len = ceph_decode_32(p); dout("decode_buffer len %d\n", (int)len); ceph_decode_need(p, end, len, bad); *b = ceph_buffer_new(len, GFP_NOFS); if (!*b) return -ENOMEM; ceph_decode_copy(p, (*b)->vec.iov_base, len); return 0; bad: return -EINVAL; } net-next plumbingsTobias Klauser
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-02-06 14:16:23 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2017-02-06 14:16:23 -0800
commit396bf4cd835e62d70fad4a03a8963e61f19021f2 (patch)
tree79ac8f33554260fea1a8d43e6f8c4c5460115f45 /net/batman-adv/hash.c
parentd5adbfcd5f7bcc6fa58a41c5c5ada0e5c826ce2c (diff)
parent7c2cf1c4615cc2f576d0604406cdf0065f00b83b (diff)
Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Pull crypto fixes from Herbert Xu: - use-after-free in algif_aead - modular aesni regression when pcbc is modular but absent - bug causing IO page faults in ccp - double list add in ccp - NULL pointer dereference in qat (two patches) - panic in chcr - NULL pointer dereference in chcr - out-of-bound access in chcr * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: crypto: chcr - Fix key length for RFC4106 crypto: algif_aead - Fix kernel panic on list_del crypto: aesni - Fix failure when pcbc module is absent crypto: ccp - Fix double add when creating new DMA command crypto: ccp - Fix DMA operations when IOMMU is enabled crypto: chcr - Check device is allocated before use crypto: chcr - Fix panic on dma_unmap_sg crypto: qat - zero esram only for DH85x devices crypto: qat - fix bar discovery for c62x
Diffstat (limited to 'net/batman-adv/hash.c')