Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'dm-3.17-fix' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm

Pull device mapper fix from Mike Snitzer:
"Fix a 3.17-rc1 regression introduced by switching the DM crypt target
to using per-bio data"

* tag 'dm-3.17-fix' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm:
dm crypt: fix access beyond the end of allocated space

+19 -6
+19 -6
drivers/md/dm-crypt.c
··· 1688 1688 unsigned int key_size, opt_params; 1689 1689 unsigned long long tmpll; 1690 1690 int ret; 1691 + size_t iv_size_padding; 1691 1692 struct dm_arg_set as; 1692 1693 const char *opt_string; 1693 1694 char dummy; ··· 1725 1724 1726 1725 cc->dmreq_start = sizeof(struct ablkcipher_request); 1727 1726 cc->dmreq_start += crypto_ablkcipher_reqsize(any_tfm(cc)); 1728 - cc->dmreq_start = ALIGN(cc->dmreq_start, crypto_tfm_ctx_alignment()); 1729 - cc->dmreq_start += crypto_ablkcipher_alignmask(any_tfm(cc)) & 1730 - ~(crypto_tfm_ctx_alignment() - 1); 1727 + cc->dmreq_start = ALIGN(cc->dmreq_start, __alignof__(struct dm_crypt_request)); 1728 + 1729 + if (crypto_ablkcipher_alignmask(any_tfm(cc)) < CRYPTO_MINALIGN) { 1730 + /* Allocate the padding exactly */ 1731 + iv_size_padding = -(cc->dmreq_start + sizeof(struct dm_crypt_request)) 1732 + & crypto_ablkcipher_alignmask(any_tfm(cc)); 1733 + } else { 1734 + /* 1735 + * If the cipher requires greater alignment than kmalloc 1736 + * alignment, we don't know the exact position of the 1737 + * initialization vector. We must assume worst case. 1738 + */ 1739 + iv_size_padding = crypto_ablkcipher_alignmask(any_tfm(cc)); 1740 + } 1731 1741 1732 1742 cc->req_pool = mempool_create_kmalloc_pool(MIN_IOS, cc->dmreq_start + 1733 - sizeof(struct dm_crypt_request) + cc->iv_size); 1743 + sizeof(struct dm_crypt_request) + iv_size_padding + cc->iv_size); 1734 1744 if (!cc->req_pool) { 1735 1745 ti->error = "Cannot allocate crypt request mempool"; 1736 1746 goto bad; 1737 1747 } 1738 1748 1739 1749 cc->per_bio_data_size = ti->per_bio_data_size = 1740 - sizeof(struct dm_crypt_io) + cc->dmreq_start + 1741 - sizeof(struct dm_crypt_request) + cc->iv_size; 1750 + ALIGN(sizeof(struct dm_crypt_io) + cc->dmreq_start + 1751 + sizeof(struct dm_crypt_request) + iv_size_padding + cc->iv_size, 1752 + ARCH_KMALLOC_MINALIGN); 1742 1753 1743 1754 cc->page_pool = mempool_create_page_pool(MIN_POOL_PAGES, 0); 1744 1755 if (!cc->page_pool) {