• Michael Halcrow's avatar
    eCryptfs: Allocate up to two scatterlists for crypto ops on keys · ac97b9f9
    Michael Halcrow authored
    I have received some reports of out-of-memory errors on some older AMD
    architectures.  These errors are what I would expect to see if
    crypt_stat->key were split between two separate pages.  eCryptfs should
    not assume that any of the memory sent through virt_to_scatterlist() is
    all contained in a single page, and so this patch allocates two
    scatterlist structs instead of one when processing keys.  I have received
    confirmation from one person affected by this bug that this patch resolves
    the issue for him, and so I am submitting it for inclusion in a future
    stable release.
    
    Note that virt_to_scatterlist() runs sg_init_table() on the scatterlist
    structs passed to it, so the calls to sg_init_table() in
    decrypt_passphrase_encrypted_session_key() are redundant.
    Signed-off-by: default avatarMichael Halcrow <mhalcrow@us.ibm.com>
    Reported-by: default avatarPaulo J. S. Silva <pjssilva@ime.usp.br>
    Cc: "Leon Woestenberg" <leon.woestenberg@gmail.com>
    Cc: Tim Gardner <tim.gardner@canonical.com>
    Cc: <stable@kernel.org>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    ac97b9f9
keystore.c 57.9 KB