]> git.baikalelectronics.ru Git - kernel.git/commit
dm crypt: use bio_add_page
authorMilan Broz <mbroz@redhat.com>
Thu, 13 Dec 2007 14:16:10 +0000 (14:16 +0000)
committerAlasdair G Kergon <agk@redhat.com>
Thu, 20 Dec 2007 17:32:13 +0000 (17:32 +0000)
commitcca458644d3ed335a7341b30c494966dc58806b4
treed40a2f0aa45427a66d024ce1b29ea7cb24cc770e
parentd22c8eae9cfb5a0e84528d51444f9a4f595dcd4b
dm crypt: use bio_add_page

Fix possible max_phys_segments violation in cloned dm-crypt bio.

In write operation dm-crypt needs to allocate new bio request
and run crypto operation on this clone. Cloned request has always
the same size, but number of physical segments can be increased
and violate max_phys_segments restriction.

This can lead to data corruption and serious hardware malfunction.
This was observed when using XFS over dm-crypt and at least
two HBA controller drivers (arcmsr, cciss) recently.

Fix it by using bio_add_page() call (which tests for other
restrictions too) instead of constructing own biovec.

All versions of dm-crypt are affected by this bug.

Cc: stable@kernel.org
Cc: dm-crypt@saout.de
Signed-off-by: Milan Broz <mbroz@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
drivers/md/dm-crypt.c