• Chris Webb's avatar
    bcachefs: Return -ENOKEY/EINVAL when mount decryption fails · 7be9ab63
    Chris Webb authored
    
    
    bch2_fs_encryption_init() correctly passes back -ENOKEY from request_key()
    when no unlock key is found, or -EINVAL if superblock decryption fails
    because of an invalid key. However, these get absorbed into a generic NULL
    return from bch2_fs_alloc() and later returned to user space as -ENOMEM,
    leading to a misleading error from mount(1):
    
      mount(2) system call failed: Out of memory.
    
    Return explicit error pointers out of bch2_fs_alloc() and handle them in
    both callers, so the user instead sees
    
      mount(2) system call failed: Required key not available.
    
    when attempting to mount a filesystem which is still locked.
    Signed-off-by: default avatarChris Webb <chris@arachsys.com>
    Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
    7be9ab63
super.c 47.9 KB