• Milan Broz's avatar
    dm crypt: use bio_add_page · 91e10625
    Milan Broz authored
    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: default avatarMilan Broz <mbroz@redhat.com>
    Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
dm-crypt.c 25.6 KB