• Matthew Wilcox's avatar
    NVMe: Handle failures from memory allocations in nvme_setup_prps · b77954cb
    Matthew Wilcox authored
    If any of the memory allocations in nvme_setup_prps fail, handle it by
    modifying the passed-in data length to reflect the number of bytes we are
    actually able to send.  Also allow the caller to specify the GFP flags
    they need; for user-initiated commands, we can use GFP_KERNEL allocations.
    
    The various callers are updated to handle this possibility; the main
    I/O path is already prepared for this possibility (as it may happen
    due to nvme_map_bio being unable to map all the segments of the I/O).
    The other callers return -ENOMEM instead of doing partial I/Os.
    Reported-by: default avatarAndi Kleen <andi@firstfloor.org>
    Signed-off-by: default avatarMatthew Wilcox <matthew.r.wilcox@intel.com>
    b77954cb
nvme.c 42.4 KB